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

RadNumericUpDown not disabling correctly

1 Answer 161 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 20 Feb 2013, 10:59 AM
Dear Telerik,

The visual state of our RadNumericUpDown elements don't always correctly adapt to the property IsChecked.
I made a small example project showing the issue.

By enabling the RadNumericUpDown
and typing a number > 50, the value should change to 100 and the RadNumericUpDownhas to get disabled.
What happens is that the value changes and the RadNumericUpDown is disabled (you can't select it or type in it).
But It does not get the 'disabled color' it should get, making it unclear to the user that it is in fact disabled.

Is there a fix for this bug?

MainPage.xaml
<UserControl x:Class="BindingToIsExpandable_SL.MainPage"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:my="clr-namespace:BindingToIsExpandable_SL"
             mc:Ignorable="d" d:DesignHeight="100" d:DesignWidth="700">
    <UserControl.Resources>
        <my:MyViewModel x:Key="MyViewModel"/>      
    </UserControl.Resources>
    <Grid DataContext="{StaticResource MyViewModel}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <telerik:RadNumericUpDown
            Margin="0,0,5,0"
            Width="75"
            Minimum="0"
            Maximum="100"
            ShowButtons="False"
            Value="{Binding Path=Value, Mode=TwoWay}"
            UpdateValueEvent="PropertyChanged"
            HorizontalAlignment="Left"
            IsEnabled="{Binding Path=Checked, Mode=TwoWay}" />
        <CheckBox
            Grid.Row="1"
            Margin="5,5,0,0"
            IsChecked="{Binding Path=Checked, Mode=TwoWay}"
            Content="Toggle IsEnabled"
            telerik:StyleManager.Theme="Office_Black" />
    </Grid>
</UserControl>

ViewModel
public class MyViewModel : INotifyPropertyChanged
    {
        private int _value;
        public int Value
        {
            get { return _value; }
            set
            {
                if ((!object.Equals(this._value, value)))
                {
                    this._value = value;
                    ChangeMax();
                    ChangeIsEnabled();
                    PropertyChanged(this, new PropertyChangedEventArgs("Value"));
                }
            }
        }
 
        private bool _checked;
        public bool Checked
        {
            get { return _checked; }
            set
            {
                if ((!object.Equals(this._checked, value)))
                {
                    this._checked = value;
                    PropertyChanged(this, new PropertyChangedEventArgs("Checked"));
                }
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void ChangeMax()
        {
            if (Value > 50)
                _value = 100;
        }
 
        private void ChangeIsEnabled()
        {
            if (Value == 100)
                Checked = false;
        }
    }

1 Answer, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 25 Feb 2013, 12:24 PM
Hi Peter,

We managed to reproduce the issue thanks to your project. It appears rather random and it seems that the problem is some synchronization issue. I have logged the issue in our PITS where you can follow its progress.

Please, excuse us for the inconvenience. We have added points to your account for the report. Don't hesitate to contact us if you have other questions.

Regards,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
NumericUpDown
Asked by
Peter
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Share this question
or