Getting WPF Data Grid Context Menu Click Row

后端 未结 6 655
无人共我
无人共我 2021-01-31 10:30

I have a WPF DataGrid



    

        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 10:57

    Typically, you do not deal with rows (if you do - think again about the reasons) - instead you work with view model. When you open context menu, you get your item selected, so it can be accessed via the DataGrid.SelectedItem property. However, if you really need DataGridRow - you have your DataGrid.SelectedIndex and there is a lot of answers here on SO on how to get the row. like Get row in datagrid

提交回复
热议问题