I have a desktop app already released (so I\'d appreciate an answer that keeps the changes and regression tests at a minimum) and I need to add a consistency check Can
What I've done till now is
against MVVM, because I've put the alert in the Model
The solution from @Tesseract, subclassing ObservableCollection and subscribing RemoveItem is already MVVM oriented.
What is still missing is a correct, modern way to send the alert from the ViewModel. This is where Mahapps approach would be helpful.
In your XAML
Dialog:DialogParticipation.Register="{Binding}"
where the attached property DialogPartecipation will keep track of the views through a dictionary
public static class DialogParticipation
{
private static readonly IDictionary
The DialogCoordinator will match the ViewModel to the View
public class DialogCoordinator : IDialogCoordinator
{
public static readonly IDialogCoordinator Instance = new DialogCoordinator();
through the above said attached property (the context being the view model)
var association = DialogParticipation.GetAssociation(context);
and display the dialog, invoking the appropriate method on the retrieved view: this is how, if you have multiple windows open, the dialog will display on the correct window.