开发者

Check for the existence of a value in a WPF datagrid

开发者 https://www.devze.com 2022-12-31 00:52 出处:网络
开发者_开发问答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
开发者_开发问答

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();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消