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

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

1 Answer 89 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Musashi
Top achievements
Rank 1
Musashi asked on 31 Jan 2014, 01:08 AM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 04 Feb 2014, 08:44 AM
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"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
        <telerik:RadMaskedCurrencyInput maskedInput:MaskedInputExtensions.AllowMinusOnZeroValue="False"/>
</UserControl>
Please give this approach a try and let me know if you need any further information.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Musashi
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or