AvaloniaUtils / DialogHost.Avalonia

AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
MIT License
228 stars 15 forks source link

Add DialogHost.Show() overloads accepting a DialogHost instance #18

Closed profix898 closed 1 year ago

profix898 commented 1 year ago

The library is designed with XAML in mind and I get the concept around the string identifier for multiple DialogHost instances. However, I do a lot of code-based (or at least non-MVVM) work, and usually I have a (reference to a) DialogHost instance. I would like to invoke a dialog directly on that instance.

This PR adds additional (static) DialogHost.Show() overloads, which are taking a DialogHost instance in place of the string identifier. You can then open a dialog on an instance by calling

DialogHost myDialogHost = ...
await DialogHost.Show(content, myDialogHost, openedEventHandler, closingEventHandler);

Note: I also fixed a typo in identifier and removed redundant async/await keywords.