Numeric Input Value should become positive when pressing "+"

4 posts, 1 answers
  1. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 06 Sep 2013 Link to this post


    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!
  2. Answer
    Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 11 Sep 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 11 Sep 2013 Link to this post

    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();

    }


  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 16 Sep 2013 Link to this post

    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 >>
Back to Top