This is a migrated thread and some comments may be shown as answers.

Negative value in MaskedInput

1 Answer 158 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
jeya
Top achievements
Rank 1
jeya asked on 17 Nov 2011, 08:41 AM
Hi,

I am using MaskedInput control for currency value. I want to set a negative currency value in the masked input control. I get () in the control when I type - symbol. How to set mask which accepts negative value for currency type.

Regards,
Jeyakumar

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 22 Nov 2011, 09:38 AM
Hello Jeya,

This is the default CurrencyNegativePattern used in "en-Us" Culture. You can view the possible negative patterns here in this msdn help article. What you could do is to change the default "en-US" culture used like so:

<telerik:RadMaskedCurrencyInput Width="300" Height="30" x:Name="input" />
public MainWindow()
      {
          InitializeComponent();
          CultureInfo cultureInfo = new CultureInfo("en-US");
          NumberFormatInfo numberFormat = new NumberFormatInfo();
          numberFormat.CurrencyNegativePattern = 8;
          numberFormat.CurrencyPositivePattern = 1;
          numberFormat.CurrencySymbol = "$";
          cultureInfo.NumberFormat = numberFormat;
 
          this.input.Culture = cultureInfo;
      }
You can also find this realized in the attached solution. Feel free to ask if you need further assistance. Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
jeya
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or