Here is a simplified version of the model for my WPF application:
Employee
+Name:string
Client
+Name:string
+PhoneNumber:string
Appointment
+Employee:Employee
+Client:Client
+DateAndTime:DateTime
My application has a few main pages organized with a TabControl. Each TabItem has an associated View and ViewModel. On one page, there is a DataGrid showing all Appointments with several specific details, like the client's phone number. One a second page, there is another DataGrid showing all Clients. These DataGrids are bound to different ViewModels since they are on different pages. My ViewModels are implemented as mere wrappers of the Model that implement INotifyPropertyChange.
And there is the problem: if the user modifies a Client's phone number on the second page, the ViewModel for that page is correctly updated (and the Model through it), but the ViewModel for the first page is not notified that a change occured. When I go back to the first page, any Appointment with that Client that was onscreen then still shows the old phone number until I do something that will cause an update of that ViewModel.
How should I solve this? Should a common ViewModel be shared between pages? Should the Model somehow notify all ViewModels when a change is made (the model currently knows nothing about the ViewModels)? This is my first MVVM project so I'm not sure how things should be done.
To make things more complex, on my first page I use a calendar control and use its SelectedDate property to determine which appointments to display. The ViewModel for that page therefore has to keep its own cached list of appointments that it updates whenever the SelectedDate changes or an appointment is added or removed.
Thanks for any help with this.