New to Telerik UI for WPFStart a free 30-day trial

Create Event That is Fired When RepeatButtons are Released

Updated on Sep 15, 2025

Environment

ProductRadNumericUpDown 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}" />
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support