RadNumericUpDown lets you type beyond its maximum value

7 posts, 0 answers
  1. Sanket Singhvi
    Sanket Singhvi avatar
    20 posts
    Member since:
    May 2010

    Posted 19 Nov 2010 Link to this post

    Hi,

    I set the maximum on RadNumericUpDown but using keyboard I can type beyond maximum value.

    Regards
    Sanket
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 23 Nov 2010 Link to this post

    Hello Sanket,

    Thank you for contacting us.

    This is by design. The Maximum property is not meant to restrict the user's input when typing in the TextBox of the NumericUpDown only when using the arrows.

    Hope this information helps. If you have further questions please let us know.

    All the best,
    Konstantina
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  3. Tim
    Tim avatar
    3 posts
    Member since:
    Jul 2010

    Posted 26 Nov 2010 Link to this post

    OK, so how do you restrict entry? The MS textbox has a MaxLength property. What is the equivalent for the RadNumericUpDown?
  4. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 29 Nov 2010 Link to this post

    Hi Tim,

    As a work-around I can suggest you to hook to the PreviewTextInput event and check the length of the typed-in text and if longer mark the event handled, for example:
    private void RadNumericUpDown_PreviewTextInput(object sender, TextCompositionEventArgs e)
    {
        var num = sender as RadNumericUpDown;
        if (num.ContentText.Length > 3)
        {
            e.Handled = true;
        }
    }

    Hope this helps. If you have further questions please let us know.

    Kind regards,
    Konstantina
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  5. maks
    maks avatar
    1 posts
    Member since:
    Sep 2013

    Posted 14 Mar 2014 in reply to Sanket Singhvi Link to this post

    <telerik:RadNumericUpDown>
                                    <telerik:RadNumericUpDown.Resources>
                                        <Style TargetType="{x:Type TextBox}">
                                            <Setter Property="MaxLength" Value="2" /> 
                                        </Style>
                                    </telerik:RadNumericUpDown.Resources>
                                </telerik:RadNumericUpDown>
  6. Prashanth
    Prashanth avatar
    3 posts
    Member since:
    Jan 2018

    Posted 07 Mar 2018 in reply to Konstantina Link to this post

    Hi Konstantina,

    I restricted the length of text as u said but I have one more requirement i.e I don't want to allow greater than the particular number when user typing in the TextBox of the RadNumericUpDown.

    Eg: NumericUpDown textbox will allow only less than the '300'

    Please suggest if any approach to solve.

     

    Thanks and Regards

    M.Prashanth Reddy

     

     

     

  7. Martin
    Admin
    Martin avatar
    160 posts

    Posted 12 Mar 2018 Link to this post

    Hi Prashanth,

    To achieve the desired behavior you can parse the ContentText property to double and if the value is greater than 300 to handle the preview event.

    I hope that this helps. If you have further questions please let us know.


    Regards,
    Martin Vatev
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top