开发者

how to get string value entered in numericupdown silverlight control?

I am using silver-light numeric up-down control. Control is set for decimal numbers.

Maximum limit 28 and minimum limit is -28

Increment steps are 0.25

using this control in dutch culture so it accept value in the form

1,2 and converts it in to 1.2

3,5 and converts it in to 3.5

10,3 and converts it in to 10.3

27,5 and converts it in to 27.5

Now my issue is that when try to enter value

1.2 it converts it into 12,00 (I want 1.2 should reflect to 1,2)

How do I achieve it?

or How do I get string value entered in the NumeriCupDown control as string.

开发者_如何学JAVA

so I can act on string as I want?

I tried using event

private void NumericUpDown_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {

        }

but does not help me lot.

Please find attached image where in Non Public member i am getting Text Property of NumericUpDown control but not able to implement that in my code how do i Get that TEXT property.

how to get string value entered in numericupdown silverlight control?


Create a subclass of NumericUpDown and override the ParseValue method:

public class MyNumericUpDown : NumericUpDown {

  protected override double ParseValue(string text)
  {
     // Change text to whatever you want
     string newText = FixText(text);

     // Call base implementation.
     base.ParseValue(newText);
  }

  private static string FixText(string inputText) {
    // DO YOUR STUFF HERE.
  } 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜