My question is very similar to ones like MVVM in WPF - How to alert ViewModel of changes in Model... or should I? and ViewModel subscribing to Model's PropertyChanged event for a specific property. However, there's a difference.
Background Info
My model is Employee, and the property I'm interested in is DisplayLtdOccupationId.
But in my ViewModel, I don't just have an instance of Employee. Rather I have a collection of Employee objects.
ObservableCollection<Employee> EmployeeCensus
In my View, I have a DataGrid that's bound to EmployeeCensus. So I have Employee rows in the grid.
Question
What I would like is to be able to respond to PropertyChanged of the particular Employee row where the value of DisplayLtdOccupationId was changed. I want to do this with a handler method in my ViewModel.
In my handler, I would expect that the Employee object that just changed would be in the 'sender' variable. Then I would take its DisplayLtdOccupationId, do a lookup from a collection that I already have in memory in the ViewModel, and set the lookup value in a different property of that same Employee object.
More Details
Both the ViewModel and Employee Model implement INotifyPropertyChanged (via : Microsoft.Practices.Prism.ViewModel.NotificationObject).
The DataGrid displays the DisplayLtdOccupationId property as an inline dropdown list where the user can choose a different value.
Why not just do this in the Employee Model, in the Setter of DisplayLtdOccupationId? Because I don't have access to the lookup collection there.
I don't want to use a trigger in the view to initiate the handler. This was causing an issue, and is why I want to explore a solution using ViewModel and Model only.
There's more I could add, but I'm trying to keep the question brief and to the point. If more information is required, please advise.