MaskedCurrencyInput, new value of 0 is negative zero if previous value was < 0

2 posts, 1 answers
  1. Musashi
    Musashi avatar
    23 posts
    Member since:
    Jan 2014

    Posted 30 Jan 2014 Link to this post

    I have a RadMaskedCurrencyInput in a grid cell, and in the grid loadingrow event the maskedInput is being set.
    If the previous value for the maskedInput is negative (appears with parentheses around the number), and the new value is zero, then the rendered value is a negative zero "(0)" instead of "0".
    Conversely, if the previous value is positive, and the new value is zero, then the rendered value is "0".
    All incoming zeros are converted to Decimal.Zero.
    What I've found is that if I set the value of the maskedInput to null, then set it to zero, then it won't render the zero as a negative.

    Is this desired behavior?

    For my particular application, all zeros need to be rendered as a positive zero. My fix seems a little hokey, but it seems to work.
  2. Answer
    Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 04 Feb 2014 Link to this post

    Hi Musashi,

    It is expected that the minus sign of the value is preserved when you change only the value of the control. In order to change the sign again, you should press the minus sign again.

    On the other hand, when you enter 0, you can configure the RadMaskedCurrencyInput control to automatically change the value to positive. You can do this with the attached property AllowMinusOnZeroValue. In your scenario you can set it to False like this:

    <UserControl x:Class="MaskedInput_SL.MainPage"
            <telerik:RadMaskedCurrencyInput maskedInput:MaskedInputExtensions.AllowMinusOnZeroValue="False"/>
    Please give this approach a try and let me know if you need any further information.

    Pavel R. Pavlov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top