WPF DataGrid get a cell

Different cell WPF and WinForm acquisition mode, as needed to cast the cell type

1. difference

(1)WinForm

string str = (string)dataGrid.Rows[0].Cells[0].Value;

 

(2)WPF

string str = (dataGrid.Columns[0].GetCellContent(dataGrid.Items[0]) as TextBlock).Text;

Guess you like

Origin www.cnblogs.com/xiale/p/11416279.html
Recommended