How to Select All CheckBox of a Column by DataGrid Header CheckBox in WPF DataGrid

后端 未结 4 936
[愿得一人]
[愿得一人] 2020-12-17 22:54

I have a DataGrid with one CheckBoxColumn. In the header of that CheckBoxColumn I have added a CheckBox to Select all CheckBoxes of that Datagrid Row.

How can I achi

4条回答
  •  离开以前
    2020-12-17 23:25

    Strictly speaking the model should not know about the view and so the solution proposed by blindmeis, where the model change is updating every row in the datagrid, breaks the MVVM/Presentation Design pattern. Remember that in MVVM the dependency flow is View -> ViewModel -> Model so if you are referencing controls in your view model (or control codebehind) then you have effectively broken the pattern and you will probably run into issues further down the track.

提交回复
热议问题