WPF Datagrid Get Selected Cell Value

前端 未结 12 2088
遇见更好的自我
遇见更好的自我 2020-11-30 08:47

I want to get value for selected cell in datagrid , please anyone tell how to do this. i used SelectedCell changed event , how can i do that?

dataGrid1.Curre         


        
12条回答
  •  误落风尘
    2020-11-30 09:48

    I was in such situation .. and found This:

    int ColumnIndex = DataGrid.CurrentColumn.DisplayIndex;
    TextBlock CellContent = DataGrid.SelectedCells[ColumnIndex].Column.GetCellContent(DataGrid.SelectedItem);
    

    And make sure to treat custom columns' templates

提交回复
热议问题