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

Numeric Input Value should become positive when pressing "+"

3 Answers 52 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 06 Sep 2013, 08:37 PM

I know this is fixed in the 2013 release as indicated in the link below but we are on 2012 Q2 and was wondering if there is a workaround to this issue.
http://www.telerik.com/help/silverlight/radmaskedinput-changes.html

I am already extending the RadMaskedNumericInput so I don't mind working with the templates or overiding some function if I have to.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 11 Sep 2013, 10:20 AM
Hello Sintayehu,

In order to achieve your requirements you can try subscribing to the KeyDown event of the RadMaskedNumericInput and detect if the "+" key is pressed. If so you can manually multiply the Value of the control by -1.

You can use similar to this logic.
if (e.Key == Key.Add)
{
    myControl.Value *= -1;
}

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 >>
0
Sintayehu
Top achievements
Rank 1
answered on 11 Sep 2013, 02:26 PM
Thank you Pavel.

I did try your approach and it works nicely for the Value but doesn't always update the displayed sign when the updateValueEvent is in Lost focus mode.

I am using the following and seems to do what I need it to do:

//if + key is detected remove the negative sign

if (e.Key == Key.Add || ((e.Key==Key.Unknown)&&(e.PlatformKeyCode == 187)))

{
    // this is the control

     if (this.IsNegativeValue)

         this.ToggleNegativeSignKey();

}


0
Pavel R. Pavlov
Telerik team
answered on 16 Sep 2013, 06:07 AM
Hi Sintayehu,

Are you saying that when you set the UpdateValueEvent to LostFocus the Value property of the control is not updated? I tried to reproduce this behavior with our latest official release on our side and it seems that the code works as expected.

Is it possible for you to try to isolate this issue in a separate project and send it over? By doing so we can further investigate the reported behavior and suggest an approach in your scenario.

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
Sintayehu
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Sintayehu
Top achievements
Rank 1
Share this question
or