<StackPanel...> |
<TelerikInput:RadNumericUpDown |
IsEnabled="{Binding ClockEnabled}" |
Value="{Binding UnitsValue, Mode=TwoWay}" |
Minimum="{Binding MinimumUnitsValue, Mode=TwoWay}" |
Maximum="{Binding MaximumUnitsValue, Mode=TwoWay}" |
SmallChange="1" ValueFormat="Numeric" IsInteger="True"/> |
<TelerikInput:RadComboBox |
x:Name="SelectedUnitComboBox" |
IsEnabled="{Binding ClockEnabled}" |
DisplayMemberPath="Label" |
SelectedValuePath="Value" |
SelectedValue="{Binding SelectedUnit, Mode=TwoWay}"/> |
</StackPanel> |
private int _MinimumUnitsValue = 0; |
public int MinimumUnitsValue |
{ |
get |
{ |
return _MinimumUnitsValue; |
} |
set |
{ |
if (value != _MinimumUnitsValue) |
{ |
_MinimumUnitsValue = value; |
NotifyPropertyChanged("MinimumUnitsValue"); |
} |
} |
} |
private int _MaximumUnitsValue; |
public int MaximumUnitsValue |
{ |
get |
{ |
return _MaximumUnitsValue; |
} |
set |
{ |
if (value != _MaximumUnitsValue) |
{ |
_MaximumUnitsValue = value; |
NotifyPropertyChanged("MaximumUnitsValue"); |
} |
} |
} |
private string _SelectedUnit = String.Empty; |
public string SelectedUnit |
{ |
get |
{ |
return _SelectedUnit; |
} |
set |
{ |
if (value != _SelectedUnit) |
{ |
_SelectedUnit = value; |
NotifyPropertyChanged("SelectedUnit"); |
switch (_SelectedUnit) |
{ |
case "days": |
MinimumUnitsValue = 1; |
MaximumUnitsValue = 30; |
break; |
case "months": |
MinimumUnitsValue = 1; |
MaximumUnitsValue = 12; |
break; |
case "years": |
MinimumUnitsValue = 1; |
MaximumUnitsValue = 70; |
break; |
} |
} |
} |
} |
Given the above, when I change the RadComboBox from Days ([1,30]) to Months ([1,12]) the Maximum value is changed, and notification is given. As result the value changes, and notification is given. However, the value shown in the control itself remains the previous value - i.e., if the dropdown is set to Days, and the NumericUpDown to 30, and I change the dropdown to months, I change the MaximumUnitsValue property to 12, which causes the UnitsValue to get set to 12 (including the notification change) yet the control still shows 30. Using the down arrow gets me 11, and up arrow gets me 12. The value is correct, but the wrong value displayed is quite misleading. This is Q1_2010_0603.
Tim