diff --git a/SukiUI.Demo/Features/Dashboard/DashboardViewModel.cs b/SukiUI.Demo/Features/Dashboard/DashboardViewModel.cs index c6a4894cd..e52fcfe53 100644 --- a/SukiUI.Demo/Features/Dashboard/DashboardViewModel.cs +++ b/SukiUI.Demo/Features/Dashboard/DashboardViewModel.cs @@ -51,7 +51,9 @@ private Task Login() private void ShowDialog() { _dialogManager.CreateDialog() + .ShowCardBackground(true) .WithViewModel(dialog => new DialogViewModel(dialog)) + .Dismiss().ByClickingBackground() .TryShow(); } diff --git a/SukiUI/Controls/SukiDialog.axaml b/SukiUI/Controls/SukiDialog.axaml index 3d685b958..f432ccf4e 100644 --- a/SukiUI/Controls/SukiDialog.axaml +++ b/SukiUI/Controls/SukiDialog.axaml @@ -7,14 +7,19 @@ + - + + + - + + + diff --git a/SukiUI/Controls/SukiDialog.cs b/SukiUI/Controls/SukiDialog.cs index cd004251b..301cb9ad5 100644 --- a/SukiUI/Controls/SukiDialog.cs +++ b/SukiUI/Controls/SukiDialog.cs @@ -49,6 +49,14 @@ public object? Icon set => SetValue(IconProperty, value); } + public static readonly StyledProperty ShowCardBackgroundProperty = AvaloniaProperty.Register(nameof(ShowCardBackground), defaultValue: true); + + public bool ShowCardBackground + { + get => GetValue(ShowCardBackgroundProperty); + set => SetValue(ShowCardBackgroundProperty, value); + } + public static readonly StyledProperty IconColorProperty = AvaloniaProperty.Register(nameof(IconColor)); public IBrush? IconColor diff --git a/SukiUI/Dialogs/FluentSukiDialogBuilder.cs b/SukiUI/Dialogs/FluentSukiDialogBuilder.cs index 4e7568c2a..bce317219 100644 --- a/SukiUI/Dialogs/FluentSukiDialogBuilder.cs +++ b/SukiUI/Dialogs/FluentSukiDialogBuilder.cs @@ -38,6 +38,15 @@ public static SukiDialogBuilder WithContent(this SukiDialogBuilder builder, obje builder.SetContent(content); return builder; } + + /// + /// Hide Card background. + /// + public static SukiDialogBuilder ShowCardBackground(this SukiDialogBuilder builder, bool show) + { + builder.SetShowCardBackground(show); + return builder; + } /// /// Gives the dialog a ViewModel. If this is used, Title/Content are ignored and only the ViewModel is rendered - the View being located by the usual strategy. diff --git a/SukiUI/Dialogs/ISukiDialog.cs b/SukiUI/Dialogs/ISukiDialog.cs index b3aa06d0c..f9e7cc7a3 100644 --- a/SukiUI/Dialogs/ISukiDialog.cs +++ b/SukiUI/Dialogs/ISukiDialog.cs @@ -15,6 +15,7 @@ public interface ISukiDialog ObservableCollection ActionButtons { get; } Action? OnDismissed { get; set; } bool CanDismissWithBackgroundClick { get; set; } + bool ShowCardBackground { get; set; } void Dismiss(); } } \ No newline at end of file diff --git a/SukiUI/Dialogs/SukiDialogBuilder.cs b/SukiUI/Dialogs/SukiDialogBuilder.cs index b4b7bd2de..06d4875a5 100644 --- a/SukiUI/Dialogs/SukiDialogBuilder.cs +++ b/SukiUI/Dialogs/SukiDialogBuilder.cs @@ -23,6 +23,8 @@ public SukiDialogBuilder(ISukiDialogManager manager) public void SetTitle(string title) => Dialog.Title = title; + public void SetShowCardBackground(bool show) => Dialog.ShowCardBackground = show; + public void SetContent(object content) => Dialog.Content = content; public void SetViewModel(Func viewModel) diff --git a/SukiUI/SukiUI.csproj b/SukiUI/SukiUI.csproj index 5e8954047..de768c923 100644 --- a/SukiUI/SukiUI.csproj +++ b/SukiUI/SukiUI.csproj @@ -21,7 +21,7 @@ 10 712f85e4-12d3-41b0-a417-5714a113666f https://github.com/kikipoulet/SukiUI - 6.0.0-beta7 + 6.0.0-beta8 enable true OIG.N5o-removebg-preview.png