I am trying to use a dataContext to populate a comboxbox but always got nothing:
EntityQuery<Tests> testQ = myDomainContext.GetTestQuery().Where(t => t == 5);
LoadOperation<Tests> loadOp = myDomainContext.Load(testQ)
comboxBoxTest.ItemSource = loadOp.Entities.Select(t => t.Name).Distinct().ToList();
Can someone tell me what is wrong here?
You probably don't load the entities. Try
EntityQuery<Tests> testQ = myDomainContext.GetTestQuery().Where(t => t == 5);
LoadOperation<Tests> loadOp = myDomainContext.Load(testQ);
loadOp.Completed += (o, e) =>
{
comboxBoxTest.ItemSource = loadOp.Entities.Select(t => t.Name).Distinct().ToList();
};
Or
myDomainContext.Load(testQ, new Action<LoadOperation<Tests>>(result =>
{
comboxBoxTest.ItemSource = result.Entities.Select(t => t.Name).Distinct().ToList();
}), null);