I have an ICollectionView built from a LINQ to Entities query comprised of an anonymous object ...I want to apply filter to this collection, however the Filter property expects a Predicate
What can I do in order to apply the filter on this anonymously typed collection?
var playerDatabase = (from p in NFLDataContext.DimPlayers
join c in NFLDataContext.DimColleges on p.CollegeID equals c.CollegeID
join pos in NFLDataContext.DimPositions on p.PositionID equals pos.PositionID
select new
{
FirstName = p.FirstName,
LastName = p.LastName,
FullName = p.FirstName + " " + p.LastName,
CollegeName = c.CollegeName,
CollegeID = p.CollegeID,
PositionCode = pos.PositionCode,
PositionName = pos.PositionName,
PositionID = p.PositionID,
PlayerID = p.PlayerID
}).ToList();
dgPlayers.ItemsSource = playerDatabase;
Elsewhere in an event handler ....
string SomeFilterCondition;
ICollectionView view = CollectionViewSource.GetDefaultView(dgPlayers.ItemsSource);
view.Filter = (item) =>
{
?????????????
};