NumericUpDown - large step by mouse wheel

3 posts, 1 answers
  1. Karel
    Karel avatar
    11 posts
    Member since:
    Aug 2011

    Posted 20 Sep Link to this post

    Hello,

    is there any way how to change NumericUpDown control so that mouse wheel would do large step instead of small step? (users would like to add 10 by mouse wheel but only 1 by up/down arrows)

     

    Thanks,

    Karel

  2. Answer
    Stefan
    Admin
    Stefan avatar
    771 posts

    Posted 25 Sep Link to this post

    Hello Karel,

    The control does not provide a mechanism for altering this default behavior. What I can suggest you as a possible solution would be to inherit the default RadNumericUpDown control and override its OnMouseWheel method. Can you please give it a try?

    Hopefully, this helps.

    Regards,
    Stefan X1
    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.
  3. Karel
    Karel avatar
    11 posts
    Member since:
    Aug 2011

    Posted 02 Oct Link to this post

    Thanks, I tried it and it works very well. Here is code I used (for someone else):

    public class CustomRadNumericUpDown : RadNumericUpDown
        {
            protected override void OnMouseWheel(MouseWheelEventArgs e)
            {
                HandleMouseWheel(e.Delta);
            }

            private void HandleMouseWheel(int delta)
            {
                if (delta > 0)
                    ChangeValue(LargeChange);
                else
                    ChangeValue(-LargeChange);
            }
        }

     

Back to Top