v00d00
v00d00

Reputation: 3265

Filterable collection mvvm

Does it any good implementation of Filterable Collection for C#?

What is required:

var data = GetEmployees();

_filtered = new FilterableCollection<Employee>(data);
_filtered.SetFilterExpression(empl => empl.DepartmentId == SelectedDepartment.Id);

...

set
{
  SelectedDepartment = value;
  _filtered.UpdateRepresentation();
}

Paging, CustomFilterBuilder and Virtualization would be a plus but not required at the moment.

Upvotes: 0

Views: 208

Answers (1)

Thomas Levesque
Thomas Levesque

Reputation: 292425

I'm not sure why you need this... WPF already does supports this, via the ICollectionView interface.

ICollectionView view = CollectionViewSource.GetDefaultView(data);
view.Filter = o => ((Employee)o).DepartmentId == SelectedDepartment.Id;

Upvotes: 2

Related Questions