简体   繁体   中英

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.

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.

在此处输入图像描述

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.
  } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM