I have two checkboxes. When I check one, I want the other to uncheck if it's currently checked. Both can be unchecked. Currently, I can check one, but when I check the other, both of them uncheck. I'm having trouble figuring out why.
Note: I want to do this all in the .xaml if possible. I've been messing with data triggers to get the proper effect with no luck so far.
<CheckBox Name="SYOChkBox">
<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=UTMChkBox}"
Value="True">
<Setter Property="IsChecked"
Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
<CheckBox Name="UTMChkBox">
<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=SYOChkBox}"
Value="True">
<Setter Property="IsChecked"
Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
Aucun commentaire:
Enregistrer un commentaire