c# code for select all checkbox in wpf datagrid

后端 未结 5 1540
一个人的身影
一个人的身影 2020-12-15 00:17

I need some c# code to select / deselect all checkboxes in a datagrid in WPF 3.5 framework. I would like to do this by clicking a single header checkbox in the grid.

5条回答
  •  甜味超标
    2020-12-15 00:33

    I would use the new databinding features in WPF. Give all of the checkboxes a one-way binding on their IsChecked property with the binding source being the master checkbox's IsChecked property.

    Another option would be to use triggers

提交回复
热议问题