I define ItemControl that contain Radio Button.
<ItemsControl x:Name="items" ItemsSource="{Binding Path=myItemList}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding Path=Key}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Now, I want to un-checked all the radioButton that the ItemsControl contain.
I want to write some method that will un-checked all those radioButton.
How can i do it ?
Thanks for any help…
I can see that the radio buttons are binded to
myItemList.Add another property (for the example named
IsChecked.)Make the method run on
myItemListand set all theIsCheckedproperties to false.Make sure the
IsCheckedproperty raises PropetyChangedEvent.For example:
If
myItemListisList(of Bla)andBlahas the propertyKeyandIsChecked.A simple For each loop can do the job:
The xaml look like this: