From a17f1076d07046d37bbe0462214119591a520792 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 24 Jan 2024 12:40:45 +0800 Subject: [PATCH] feat: implement default button for dialog control. --- .../Dialogs/DialogWithActionViewModel.cs | 2 +- demo/Ursa.Demo/Dialogs/PlainDialog.axaml | 5 +- demo/Ursa.Demo/Pages/DialogDemo.axaml | 1 + .../ViewModels/DialogDemoViewModel.cs | 17 ++- src/Ursa.Themes.Semi/Controls/Dialog.axaml | 26 ++++ src/Ursa/Controls/Dialog/Dialog.cs | 2 + src/Ursa/Controls/Dialog/DialogControl.cs | 144 +++++++++++++++--- src/Ursa/Controls/Dialog/DialogOptions.cs | 2 +- src/Ursa/Controls/Dialog/IDialogContext.cs | 2 +- src/Ursa/Controls/Dialog/OverlayDialogHost.cs | 8 +- 10 files changed, 181 insertions(+), 28 deletions(-) diff --git a/demo/Ursa.Demo/Dialogs/DialogWithActionViewModel.cs b/demo/Ursa.Demo/Dialogs/DialogWithActionViewModel.cs index 87aa3b4..37c0cdc 100644 --- a/demo/Ursa.Demo/Dialogs/DialogWithActionViewModel.cs +++ b/demo/Ursa.Demo/Dialogs/DialogWithActionViewModel.cs @@ -12,7 +12,7 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext [ObservableProperty] private string _title; [ObservableProperty] private DateTime _date; public object? DefaultCloseResult { get; set; } = true; - public event EventHandler? Closed; + public event EventHandler? Closed; public ICommand OKCommand { get; set; } public ICommand CancelCommand { get; set; } diff --git a/demo/Ursa.Demo/Dialogs/PlainDialog.axaml b/demo/Ursa.Demo/Dialogs/PlainDialog.axaml index 7879fe4..3888975 100644 --- a/demo/Ursa.Demo/Dialogs/PlainDialog.axaml +++ b/demo/Ursa.Demo/Dialogs/PlainDialog.axaml @@ -4,5 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Ursa.Demo.Dialogs.PlainDialog"> - + + + + diff --git a/demo/Ursa.Demo/Pages/DialogDemo.axaml b/demo/Ursa.Demo/Pages/DialogDemo.axaml index 9eb9357..4fc535a 100644 --- a/demo/Ursa.Demo/Pages/DialogDemo.axaml +++ b/demo/Ursa.Demo/Pages/DialogDemo.axaml @@ -25,6 +25,7 @@ +