WPF DataGrid multiselect binding

后端 未结 4 769
眼角桃花
眼角桃花 2020-12-10 13:00

I have a datagrid that is multi-select enabled. I need to change the selection in the viewmodel. However, the SelectedItems property is read only and can\'t be directly boun

4条回答
  •  被撕碎了的回忆
    2020-12-10 13:13

    I haven't worked with the DataGrid much, but one technique that works for the ListView is to bind to the IsSelected property of the individual ListViewItem. Just set this to true for each object in your list, and then it will get selected.

    Maybe the object that represents a row in the DataGrid also has an IsSelected property, and can be used in this way as well?

提交回复
热议问题