dotnet / DataGridExtensions

Modular extensions for the WPF DataGrid control

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Access the filtered collection from viewmodel

abid76 opened this issue · comments

First of all thanks for this great project.

In my project datagrid is populated by an ObservableCollection in the viewmodel.

AFAIK the viewmodel doesn't know about filtering as filtering is performed in the view. Right?

Problem: the viewmodel needs to know which items of the ObservableCollection are currently displayed according to the filter.

Is there any way to access/create a subset of the viewmodel's ObservableCollection according to the filter?

Thanks in advance.

You could create the CollectionView in the view model and bind the DataGrid to that. The CollectionView holds the filtered collection.

Ok, that's easy. Thanks!