This is a migrated thread and some comments may be shown as answers.
ValueChanged - RadNumericUpDown vs RadMaskedNumericInput
1 Answer 23 Views
This is a migrated thread and some comments may be shown as answers.
Przemyslaw
Top achievements
Rank 1
Przemyslaw asked on 30 Jul 2018, 07:22 AM

Hello,

The RadMaskedNumericInput.ValueChanged event is only fired after a user-triggered action, whereas RadNumericUpDown.ValueChanged not (changing value from code behind triggers this event aswell).

Does this difference is a desired behavior? Is there a possibility to make RadNumericUpDown act like RadMaskedNumericInput?

Please see code sample below.

    public partial class MainView : Window
    {
        public MainView()
        {
            InitializeComponent();
            RadNumericUpDownTest.ValueChanged += RadNumericUpDownTestOnValueChanged;
            RadMaskedNumericInputTest.ValueChanged+=RadMaskedNumericInputTestOnValueChanged;
            UpdateButton.Click+=UpdateButtonOnClick;
        }

        private void UpdateButtonOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            RadNumericUpDownTest.Value = 1;
            RadMaskedNumericInputTest.Value = 1;
        }

        private void RadNumericUpDownTestOnValueChanged(object sender, RadRangeBaseValueChangedEventArgs radRangeBaseValueChangedEventArgs)
        {
            //This event is triggered after value is changed from code behind
        }


        private void RadMaskedNumericInputTestOnValueChanged(object sender, RadRoutedEventArgs radRoutedEventArgs)
        {
            //This event is not triggered after value is changed from code behind
        }
    }

1 Answer, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 01 Aug 2018, 10:26 AM
Hello Przemyslaw,

Thank you for your interest in our RadNumericUpDown control for WPF.

The RadMaskedTextInput.ValueChanged event is only fired after a user-triggered action. As changing the value of the control in code-behind isn't considered a user-triggered interaction, the event handler is never executed.
The RadNumericUpDown.ValueChanged event will be fired when a user changed the value or the value is changed programmatically. This is the default behavior on both controls. What I can suggest to you at this moment for the RadNumericUpDown control is to create a flag when you update the value from code behind. This way you will know whether the value is changed from the user input or not. 

Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Przemyslaw
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Share this question
or