MaskedInputCurrency, Decimal Seperator,Culture issues and Negative Values

4 posts, 0 answers
  1. marinus bosman
    marinus bosman avatar
    4 posts
    Member since:
    Apr 2005

    Posted 08 Sep 2011 Link to this post

    Hi,

    We are trying to use the MaskedInputCurrency control but we're having issues using different cultures.

    Especially the data input goes haywire when using cultures with a different decimal seperator. (using the Dutch Culture for example)
    Normally entering 123 in the currency control gives 123.00, but when switching culture the input becomes 1.23

    Also we cant get a Negative value, when using the
    UpdateValueEvent="LostFocus" but it works fine with "PropertyChanged"
    You can enter a negative value, but when exiting the field it reverts back to the postivive value.
    (except when programaticly setting a negative value, it stays negative all the time, and you cant switch to a positive one)

    A smaller issue is that the negative sign (mostly '-' or '()' ) is shown twice ( '--123' and '((123)' ) when the control is unfocussed.

    Hope you can help us,
    Marinus

    PS The MaskedNumeric Input works fine and doesn't have these issues, but it uses the wrong seperators (for numeric instead of currency)

    PPS the code we are using; the converter is a toCents converter as we store the values a an Int. we are using the latest build 2.0823.40

     <telerik:RadMaskedCurrencyInput 
        IsCurrencySymbolVisible
    ="False"     IsClearButtonVisible="False"     InputBehavior="Insert"     Mask="#9.2"     SelectionOnFocus="SelectAll"     TextMode="PlainText"      SpinMode="PositionAndValue"     UpdateValueEvent="PropertyChanged"      Placeholder=" "     AutoFillNumberGroupSeparators="True"  >                 <telerik:RadMaskedCurrencyInput.Value>                     <t:XBinding Path="Parameters.Amount" Mode="TwoWay"                             Converter="{x:Static t:AmountConverter.Default}">                         <Binding.ValidationRules>                             <StaticResource ResourceKey="AmountValidationRule" />                         </Binding.ValidationRules>                     </t:XBinding>                 </telerik:RadMaskedCurrencyInput.Value> </telerik:RadMaskedCurrencyInput>
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 08 Sep 2011 Link to this post

    Hi Marinus Bosman,

    Thank you for reporting these issues.

    The incorrect negative sign when using LostFocus is a known issue for us right now. We are currently working on this issue which is going to resolve the incorrect minus sign as well. On a side note, the UpdateValueEvent property is mainly designed for SL, as it does not have a UpdateSourceTrigger - PropertyChanged. As you are using the WPF version, have you tried setting the UpdateSourceTrigger to LostFocus on the binding rather than the UpdateValueEvent on the input control?

    Regarding the last issue, I would recommend using the FormatString property for formatting (when the control is not focused). For example :
    Mask="#9.2" FormatString="c4" or FormatString="{}{0:c4}"
    You should not encounter this issue.

    You can make the numeric input use the decimal separators. What you need to do is change the and switch the separator properties:
    For example:
    var culture = CultureInfo.CreateSpecificCulture("nl-BE");
    culture.NumberFormat.NumberDecimalSeparator = CultureInfo.GetCultureInfo("nl-BE").NumberFormat.CurrencyDecimalSeparator;

    Please let me know if you have questions on this matter.

    All the best,
    Alex Fidanov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. marinus bosman
    marinus bosman avatar
    4 posts
    Member since:
    Apr 2005

    Posted 09 Sep 2011 Link to this post

    Hello,
    Thank you for your quick answer, we have been trying the suggestions you have given, we are trying out using the binding and format string.

    Unfortunatly the main issue still is that with different cultures the data input goes haywire.

    Our first finding that the Number control does not have the issues seem to be incorrect as our developer found out after trying out your suggestions. (using the currency settings on the numeric control)

    For clarification this is the issue.
    When the Windows culture is set to US, data entry works as expected.
    Selecting the Control and Entering 123 gives you an entry of $123.00, entering 1234 gives you $ 1,234.00 
    and entering 1234.56 gives you $ 1,234.56
    So far so good, works as a charm.
    When switching to a culture (NL) for example with switched decimal and thousand markers , the input goes haywire.
    Selecting the control and entering 123 gives € 1,23, entering 1234 gives you €1,24
    and trying to change the 1,24 to something else (€ 561,24) gives completly unpredictable results.
    It is almost impossible to increase the amount by a factor of 10, or change the Euro.
    You can see that the control pick up on the windows culture as the placeholders for the seperators and currency groupings actually change.
    Only to find that the input does take these into account.

    Regards,
    Marinus
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 Sep 2011 Link to this post

    Hi Marinus Bosman,

    We investigated this behavior when setting the "NL" Culture and it appeared that the problem is more general. We logged an issue in our PITS(MaskedInput: Incorrect input behavior when the Culture has empty space in the CurrencyPattern and the EmptyContent is set to " ") where it will be soon published and you will be able to track its status. Please let us know if you need more info on this.

    Kind regards,
    Petar Mladenov
    the Telerik team

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

Back to Top