Filtering an Observable Collection in WPF MVVM via ICollectionView
I have an observabelCollection of a data object:
Each
In terms of what this represents, each Gist has a collection of GistFiles. I am mapping this onto a TreeViewControl (root being Gists, Child being GistFiles) via the following xaml (abridged):
This works successfully. Now I am trying to introduce a filter feature. I have followed a guide online somewhere which advises using
And changing my xaml to:
I'm just trying to get the default list presented first. However, this does not work. No list items are displayed.
The full code is here: https://github.com/stigzler/VisGist/blob/master/VisGist/ToolWindows/MainWindow.xaml
What am I missing?
Each
GistViewModel has the following:In terms of what this represents, each Gist has a collection of GistFiles. I am mapping this onto a TreeViewControl (root being Gists, Child being GistFiles) via the following xaml (abridged):
This works successfully. Now I am trying to introduce a filter feature. I have followed a guide online somewhere which advises using
ICollectionView. I implement this thus:And changing my xaml to:
I'm just trying to get the default list presented first. However, this does not work. No list items are displayed.
GistFilesToFirstFilenameConverter doesn't get called when Binding = GistsViewThe full code is here: https://github.com/stigzler/VisGist/blob/master/VisGist/ToolWindows/MainWindow.xaml
What am I missing?
GitHub
Contribute to stigzler/VisGist development by creating an account on GitHub.
