RadNumericUpDown lets you type beyond its maximum value

5 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. UI for WPF is Visual Studio 2017 Ready
  4. 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?
  5. 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
  6. 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>
Back to Top
UI for WPF is Visual Studio 2017 Ready