Silverlight 4 datagrid and Selecting All Checkboxes when select the Group Header CheckBox
I have a datagrid with Grouping ON and whose first col is a Ch开发者_开发技巧eckbox. I'm looking to have the CheckBox on the Group Level so that the User click one checkbox and it automatically select all the checkboxes under that groud and vicevera.
I also have a Print button which when pressed should have arary of all the rows with CheckBox checked
How can I do that? Any response would be much appreciated
You need to start by retemplating the RowGroupHeaderStyles
to add a CheckBox
to the group headers. Then you should be able to iterate the backing collection and set the checkbox value in the event handler for the CheckBox
in the GroupHeaders.
The difficult part is that you need to be able to determine what is in the group of the header that fired the event. You should be able to figure this by examining the DataContext
of the sender
in your event handler. It should be the group that that header represents and from there you should be able to manipulate the items.
精彩评论