Question

I expect LastNumberWeeks NumericUpDown to be disabled on form load but it isn't. Once I switch the radio selection back and forth it works properly, just not on first load. Outside of explicitly setting this value in the code behind what can I do (I really don't want to have to use a code behind because of this one case).

<RadioButton GroupName="DayRangeGroup" Content="Last number of usable occurences:"  Name="LastUsableOccurancesRadioButton" IsChecked="True" />           
<winControls:NumericUpDown x:Name="LastUsableOccurances" IsEnabled="{Binding ElementName=LastUsableOccurancesRadioButton, Path=IsChecked}"   />      
<RadioButton GroupName="DayRangeGroup"Content="Last number of weeks:"  Name="LastNumberOfWeeksRadioButton"  />          
<winControls:NumericUpDown x:Name="LastNumberWeeks" IsEnabled="{Binding ElementName=LastNumberOfWeeksRadioButton, Path=IsChecked}" />
Was it helpful?

Solution

I just tested the XAML with a TextBox instead of the winControls:NumericUpDown and it is working as expected on load, so it's not a problem with the XAML. Try setting the UpdateSourceTrigger to PropertyChanged to see if it might help. You can also try using a view model to bind to instead of binding to the element.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top