Question

I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a separate data structure then the list of states the ItemsControl's ItemSource is bound to.

Was it helpful?

Solution 2

In the data template I subscribed to the checkbox's onload event. And in the event handler I add the checkbox reference to a generic list of checkbox.

OTHER TIPS

Have a property in your DataObject called IsChecked and bind that to the Checkbox in DataTemplate(Default is TwoWay)

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