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

RadMaskedNumericInput with a leading decimal not behaving as expected

7 Answers 434 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 22 Apr 2013, 11:00 AM
Hello,

I am using this control and am having negative feedback because users cannot type in .6 for example and get the control to display 0.6.
Instead if you type .6 the control actually displays 6.0. Is there anything that can be done about this??

Thanks.


<RadMaskedNumericInput Value="{ Binding BgsPremiumRate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"  FormatString="n2" InputBehavior="Replace" Mask="" SelectionOnFocus="SelectAll"  TextMode"PlainText" />

7 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 25 Apr 2013, 07:40 AM
Hi Alex,

 What stays behind this issue is that RadMaskedNumericInput should have a valid value in every moment and the valid values are:
- null
- double
So practically "." means nothing and that is why it is not displayed in no-mask NumericInput. In a normal MaskedNumeric Input where Mask in not "", users can type "." then 6 which will produce 0.6 if the initial value is 0.0.

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alex
Top achievements
Rank 1
answered on 25 Apr 2013, 08:37 AM
Ok. The requirements for my textbox are:

  • No underline under the number (achieved by using a Mask="")
  • Any number of numbers to the right of the decimal place (not sure why this works, probably because there is no mask specified)
  • A defined number of numbers to the left of the decimal place (achieved with FormatString="n2")
  • .6 being treated as 0.6 (not currently working when Mask="")

It seems having a Mask creates the the underlining issue, and having no Mask creates the .6 issue so I can't achieve what I need. Is there no way to meet all my requirements?

Ironically all my requirements can be achieved with the standard WPF text box:

<TextBox Text="{ Binding Age, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=n2}"  />


0
Petar Mladenov
Telerik team
answered on 29 Apr 2013, 07:07 AM
Hi Alex,

Since this TextBox's configuration works for you, you can consider using RadMaskedTextInput with Placeholder = " " (this will remove the underlining):

<telerik:RadMaskedTextInput
               Placeholder=" "
               Text="{ Binding Age, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=n2}" />
MaskedTextInput will give you power in validation scenarios, has built-in Clear Button and so on. Hope this is suitable for you.
Having non-fixed number of digits after the decimal point in NumericInput is still a feature request in our PITS.

Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alex
Top achievements
Rank 1
answered on 30 Apr 2013, 09:59 AM
Hello,

I'm now using the code below as you suggested. This doesn't restrict the number of digits after the decimal point to 2 as I thought it might and doesn't offer the comma formatting to illustrate thoudands. The RadMaskedNumericInput box is the closest I have come to providing what my client needs. Can I make a request for change to allow this box to accept .6 and then show 0.6 and not 6.0? Is there a request process for new features?
<telerik:RadMaskedTextInput  IsClearButtonVisible="True" Text="{ Binding Age, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, StringFormat=n2}" Placeholder=" "  />
0
Petar Mladenov
Telerik team
answered on 01 May 2013, 02:01 PM
Hello Alex,

 I am little bit confused since you first needed this requirement:

Any number of numbers to the right of the decimal place (not sure why this works, probably because there is no mask specified)

but then you mentioned that the proposed settings do not restrict the numbers after the decimal point:

This doesn't restrict the number of digits after the decimal point to 2.

However, we created a PITS item for the requirement to process ".6" as 0.6 in NO-Mask Numeric input.
You can track its status and vote for it, this way increasing its development priority.


Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alex
Top achievements
Rank 1
answered on 01 May 2013, 03:03 PM
Uh, sorry. I got the left and right round the wrong way. I meant to say restrict the number of decimal places to the right and allow any number of numbers to the left. Anyway, if there is a request in the queue for this .6 being treated as 0.6 then my XAML is fine as it is.

Out of interest what is the general turn around time for these requests?

Thanks,

Alex
0
Petar Mladenov
Telerik team
answered on 06 May 2013, 06:53 AM
Hi Alex,

 There is no typical time frame for our feature requests in PITS. However, the more votes they get the bigger is their development priority.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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