Silverlight 4数据网格和选择组标题复选框时选择所有复选框
我有一个分组打开的数据网格,其第一个列是一个复选框。 我希望在组级别上有一个复选框,以便用户单击一个复选框,它会自动选择该组下的所有复选框,反之亦然。
我还有一个“打印”按钮,按下该按钮后应该会显示选中复选框的所有行的数组,
我该怎么做? 任何回应将不胜感激
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要首先重新设计
RowGroupHeaderStyles
以将CheckBox
添加到组标题。然后,您应该能够迭代支持集合并在 GroupHeaders 中的CheckBox
的事件处理程序中设置复选框值。困难的部分是您需要能够确定触发事件的标头组中的内容。您应该能够通过检查事件处理程序中的
sender
的DataContext
来弄清楚这一点。它应该是该标题代表的组,并且从那里您应该能够操作这些项目。You need to start by retemplating the
RowGroupHeaderStyles
to add aCheckBox
to the group headers. Then you should be able to iterate the backing collection and set the checkbox value in the event handler for theCheckBox
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 thesender
in your event handler. It should be the group that that header represents and from there you should be able to manipulate the items.