Negative value in MaskedInput

2 posts, 0 answers
  1. jeya
    jeya avatar
    20 posts
    Member since:
    May 2011

    Posted 17 Nov 2011 Link to this post

    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
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 22 Nov 2011 Link to this post

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

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top