Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. Decimal separator and textboxes

Decimal separator and textboxes

Scheduled Pinned Locked Moved WPF
wpfwcfhelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gian
    wrote on last edited by
    #1

    Hello, i've some problems binding decimal values (double) with the TextBox or TextBlock control. The value is showed with the english decimal separator ( . ) and not the local one ( , ) This is an example: http://img135.imageshack.us/img135/3120/xamlny0.png[^] The same problem appears when i create a property in my classes then return (via the get function) a value calculated on the fly. If i bind directly the control with a double property without the get/set functions it works correctly. Do i need to set somewhere the culture? I've tried to change it in the project settings but without solving anything.

    T 1 Reply Last reply
    0
    • G Gian

      Hello, i've some problems binding decimal values (double) with the TextBox or TextBlock control. The value is showed with the english decimal separator ( . ) and not the local one ( , ) This is an example: http://img135.imageshack.us/img135/3120/xamlny0.png[^] The same problem appears when i create a property in my classes then return (via the get function) a value calculated on the fly. If i bind directly the control with a double property without the get/set functions it works correctly. Do i need to set somewhere the culture? I've tried to change it in the project settings but without solving anything.

      T Offline
      T Offline
      Thomas Stockwell
      wrote on last edited by
      #2

      If you use binding you need to make sure that you properly create the WPF compliant properties in the code. The syntax is slightly different than regular properties that only work with non-WPF controls. Normal property:

      public string Test
      {
      get;
      set;
      }

      I following code is WPF compliant for interaction with binding (also found in this MSDN article[^]:

      public static readonly DependencyProperty IsSpinningProperty =
      DependencyProperty.Register(
      "IsSpinning", typeof(Boolean),

      ...

      );
      

      public bool IsSpinning
      {
      get { return (bool)GetValue(IsSpinningProperty); }
      set { SetValue(IsSpinningProperty, value); }
      }

      Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my Blog

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups