New to Telerik UI for WPF? Start a free 30-day trial
Create Event That is Fired When RepeatButtons are Released
Updated on Sep 15, 2025
Environment
| Product | RadNumericUpDown for WPF |
Description
How to receive only one notification, when the user releases the RepeatButton in a RadNumericUpDown.
Solution
Inherit the RadNumericUpDown control and add a handler for the MouseLeftButtonUp event of the RepeatButtons within the control. In that event handler, raise a custom RoutedEvent.
C#
public class MyNumericUpDown : RadNumericUpDown
{
public MyNumericUpDown()
{
this.AddHandler(RepeatButton.MouseLeftButtonUpEvent, new MouseButtonEventHandler(IncreaseDecreaseButton_MouseLeftButtonUp), true);
}
private void IncreaseDecreaseButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
this.RaiseFinalValueChangedEvent();
}
public static readonly RoutedEvent FinalValueChangedEvent = EventManager.RegisterRoutedEvent(
"FinalValueChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyNumericUpDown));
public event RoutedEventHandler FinalValueChanged
{
add { AddHandler(FinalValueChangedEvent, value); }
remove { RemoveHandler(FinalValueChangedEvent, value); }
}
void RaiseFinalValueChangedEvent()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(MyNumericUpDown.FinalValueChangedEvent);
RaiseEvent(newEventArgs);
}
}
If the NoXaml dlls are used, the custom control's style should be based on the default one like so:
XAML
<Style TargetType="local:MyNumericUpDown" BasedOn="{StaticResource RadNumericUpDownStyle}" />