简体   繁体   中英

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 Checkbox. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM