更新时间:2023-12-06 10:32:52
您已经发现,WPFDataGrid
没有Rows
属性
尝试这样的操作:
As you have discovered, the WPFDataGrid
does not have aRows
property
Try something like this:
foreach (System.Data.DataRowView dr in datagrid.ItemsSource)
{
string t = dr[3].ToString();
if (t =="research_Key")
{
MesssageBox.Show("ok");
}
}
但是正如@ Richard-MacCutchan指出的那样-t
只会是DataGrid中最后一行的字符串
But as @Richard-MacCutchan pointed out - t
will only be the string from the last row in the DataGrid