Reputation: 119
I have 3 radiobuttons and one checkbox. I want to disable radio button 2 when the checkbox is unchecked. That works fine by using
<RadioButton x:Name="rbButtton2" Content="Button2" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="gnKind"
IsEnabled="{Binding ElementName=cbCheck, Path=IsChecked}"/>
BUT, I want that IF radio button 2 happens to be checked when the check box is unchecked, then uncheck it, then check radiobutton1 and disable it. How could I achieve that the best way?
Upvotes: 0
Views: 1916
Reputation: 7736
The best way is to use triggers. You would basically use a MultiDataTrigger on IsEnabled=false and IsChecked=true and if it falls in there, the trigger would set IsChecked=false on button1 and IsChecked=true on button2.
Upvotes: 1