I have seen the other questions:
ObservableCollection dependency property does not update when item in collection is deleted
MVVM binding to a User Control with an ObservableCollection dependency property
... an even...
https://go4answers.webhost4life.com/Example/databinding-observable-collection-196835.aspx
But they are either doing something I'm not or I just ain't getting it.
- I am using MVVM.
- I have a DataGrid on a View that holds a list of Members.
- When the user right-clicks on the DataGrid I have a menu of RelayCommands (bound from the ViewModel) that opens.
- If the user selects more than one Member I want MergeMember.CanExecute to return true.
- Since I can't bind to the SelectedItems collection I have a DependencyProperty in the View that I fill when the selection changes.
My problem is that the DependencyProperty fires a change when the property itself changes (i.e. the ObservableCollection gets "newed") but not when the items in the collection get changed.
The other solutions I've seen catch the change in the View, I'm trying to notify the ViewModel of the change.
How do I notify the ViewModel of changes to the DependencyProperty collection?
I can post code examples if you feel the need but it's a mess from all the things I've been trying.