I am binding property type of ICollectionView on DataGrid controls in WPF, .NET 4.0.
I use Filter
on ICollectionView
.
public ICollectionView CallsView
{
get
{
return _callsView;
}
set
{
_callsView = value;
NotifyOfPropertyChange(() => CallsView);
}
}
private void FilterCalls()
{
if (CallsView != null)
{
CallsView.Filter = new Predicate<object>(FilterOut);
CallsView.Refresh();
}
}
private bool FilterOut(object item)
{
//..
}
Init ICollection view:
IList<Call> source;
CallsView = CollectionViewSource.GetDefaultView(source);
I am trying to solve this problem:
For example source data count is 1000 items. I use filter, in DataGrid control I show only 200 items.
I would like convert ICollection
current view to IList<Call>
You can try:
List<Call> CallsList = CallsView.Cast<Call>().ToList();