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

NumericUpDown - large step by mouse wheel

2 Answers 165 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Karel
Top achievements
Rank 1
Karel asked on 20 Sep 2017, 09:33 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 25 Sep 2017, 03:04 PM
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.
0
Karel
Top achievements
Rank 1
answered on 02 Oct 2017, 08:38 AM

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

 

Tags
NumericUpDown
Asked by
Karel
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Karel
Top achievements
Rank 1
Share this question
or