且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将datagridview行数从Windows窗体应用程序转换为WPF应用程序

更新时间:2023-12-06 10:32:52

您已经发现,WPF DataGrid没有Rows属性

尝试这样的操作:
As you have discovered, the WPF DataGrid does not have a Rows 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