views:

345

answers:

2

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.

+1  A: 

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

Jobi Joy
ItemContainnerGenerater is not a member of ItemsControl in Silverlight.
Aaron Fischer
Oops sorry I didnt notice the Silverlight :)
Jobi Joy
A: 

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.

Aaron Fischer