Check for the existence of a value in a WPF datagrid
I want to retrieve data from WPF datagrid depending on certain condition. But the problem is, I am not sure if the data exist. How to check it?
Hope you've some Collection or List bound to the datagrid. If so you can query it like this:
var query = yourList.Where(item => item.Name = "abc" ); // retrieve items having Name 'abc'
var retrievedItems;
if(query.Any)
{
retrievedItems = query.ToList();
}
精彩评论