mvvm-dialogs
mvvm-dialogs copied to clipboard
ICloseable to close View from ViewModel
While working on the Avalonia demos, I added a neat new feature to allow closing the View from the ViewModel
All the user needs is to implement ICloseable from the ViewModel.
In DialogService, when showing the window, it hooks into the event to close the view
var dialog = CreateDialog(dialogType, ownerViewModel, viewModel);
if (viewModel is ICloseable c)
{
c.RequestClose += (_, _) => dialog.Close();
}
dialog.Show();
Until the new version is ready, this could come in handy in the current library.
By the same token; can also add IActivable interface with event RequestActivate.
Thanks @mysteryx93!
I'm mentally building a roadmap for getting all functionality from #177 into this repo. Let's revisit this issue when we've gotten further down the road with #177.
It's already implemented in my code branch. I just thought it could be added to the old code branch as well, which could be kept for compatibility reasons.
This repository has transitioned into a state where it's actively maintained but not actively developed. The README has been updated to reflect this. Thanks for the proposal but unfortunately this won't be implemented.