![](/img/trans.png)
[英]Master-Detail datagrids binded to dbcontext/dataset not filtering
[英]DBContext Filtering
if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedArea))
{
using (dbContext c = new dbContext(dbContext.ConnectionString))
{
c.CreateIfNotExists();
c.LogDebug = true;
MainLongListSelector.ItemsSource = c.details.ToList();
}
}
我想过滤dbcontext中的内容,该怎么办? 谁来帮帮我
以这种方式尝试
MainLongListSelector.ItemsSource = c.details.Where(elem=> elem.Property==5).ToList();// returns elements with Property=5
我假设您的details
具有名称为Property
但是您可以使用字段。例如.Where(elem=> elem.Name=='Peeter' && elem.Age > 30) //takes elements with Age > 30 and Name=Peter
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.