irihitech / Ursa.Avalonia

Ursa is a UI library for building cross-platform UIs with Avalonia UI.
https://irihitech.github.io/Ursa.Avalonia/
MIT License
645 stars 63 forks source link

Dialog system improvement #370

Closed rabbitism closed 2 months ago

rabbitism commented 2 months ago

Improve Dialog and drawer close button visibility control.

IsCloseButtonVisible in all options are now nullable boolean type.

  1. If it is true or false, it directly controls the visibility of close button.
  2. If it is null, and dialog/drawer is not custom, it follows the default rule based on dialog type and view model. If DataContext implements IDialogContext, close button will be visible. If Dialog mode is not YesNo, close button will be visible.
  3. To retain the close button size occupation, close button will be hidden instead of invisible.

A11y improvement

For MessageBox and default Dialog, a default button is set. When clicking on close button or pressing ESC key, the default result is returned based on WPF rule . See details in Display a message box dialog button option default button default close result
OK OK OK
OKCancel OK Cancel
YesNo Yes -
YesNoCancel Cancel Cancel

Improve Dialog and Drawer demo page.