ValueChanged - RadNumericUpDown vs RadMaskedNumericInput

2 posts, 0 answers
  1. Przemyslaw
    Przemyslaw avatar
    1 posts
    Member since:
    Mar 2016

    Posted 30 Jul 2018 Link to this post

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

  2. Dinko
    Admin
    Dinko avatar
    874 posts

    Posted 01 Aug 2018 Link to this post

    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.
Back to Top