在我的wpf项目表单中, 我有变量Items'var'类型,其内容DataGridRow为
{ Id = 26, Challan_No = 2014CH 10026, Organization = dd, Organization_Name = Unique Art, Date = 30-Nov-14 12:00:00 AM }
所以我想得到“Chalaan_No”值(2014CH 10026)
答案 0 :(得分:1)
假设您有一个代表您的DataRows的类,这应该可以帮助您入门:
private void TestDgvFilter()
{
DataGrid DG = new DataGrid();
DG.Items.Filter = new Predicate<object>(Filter);
}
private bool Filter(object t)
{
DataItem d = t as DataItem;
return (d.Challan_No == "2014CH 10026");
}
/// <summary>
/// Class that represents your data grid row items
/// </summary>
private class DataItem
{
public string Id;
public string Challan_No;
public string Organization;
public string Organization_Name;
public string Date;
}
参考:http://msdn.microsoft.com/en-us/library/dd833072(v=vs.95).aspx