This project has moved and is read-only. For the latest updates, please go here.

Bind Items in DataGrid to ViewModel

Nov 17, 2014 at 4:31 PM
Is there a way to bind the items in a DataGrid which are visible after a filter has been applied to a viewmodel? I would like to do this so that I can work on items which are in the filter results only in the viewmodel.

If not could I suggest this as a feature?

Excellent work by the way.

Thanks
Nov 19, 2014 at 6:48 PM
There is no direct way to do this.
This is similar to the problem how to bind the SelectedItems to the view model, just simpler because it's only "one way to source".
You can find a sample how to bind the SelectedItems in my ResXResourceManager project (https://resxresourcemanager.codeplex.com/), see MultiSelectorExtensions.cs.

Problems like this are generally related to all ItemsControl or Selector implementations, not only to the DataGrid, that's why there is nothing in the DataGridExtensions.
E.g. the MultiSelectorExtensions mentioned above are used both with the ListBox and the DataGrid.