c# - Binding a decimal value with InvariantCulture -


I have a textbox which is linked to the decimal property.

In our requirment the behavior is invention welfare .

When a user type is 6.30 , the value should be 6,30

if a user type 6,30 , the value should be 6,30

, currently bindings

text ">

Your requirement is not really in the behavior of InvariantCulture . To allow typing in both types of numbers, either . or

  public class multicore counters: IValueConverter {public object convert (object value) Type Type, Object Parameter, System Globalization. Culture Information Culture) {var ci = System.Globalization.CultureInfo System.Globalization.Culture Information.Ci.NumberFormat.NumberDecimalSeparator = ",";; Compensate ((decimal) value). String (ci); } Public Object Convertback (Type Object Value, Type Type, Object Parameter, System Globilization. Culture Information Culture) {var ci = System.Globalization.CultureInfo.InvariantCulture.Clone () As a system. Globalization.CultureInfo; Var s = System.Convert.ToString (value); Decimal d; If (Decimal try purse (s, system globalization number number, number ^ system globilization number number, elove trace, ci, out d)) {return d; } Other {ci.NumberFormat.NumberDecimalSeparator = ","; If (Decimal tray purse (s, system globalization number number, number ^ system globalization number number. Elove trace, ci, out d)) returns d; } Binding return nothing; }}  

Comments