diff --git a/Material.Avalonia.Dialogs/Styles/EmbeddedDialogControl.axaml b/Material.Avalonia.Dialogs/Styles/EmbeddedDialogControl.axaml index 8c3e92b6..ace8e574 100644 --- a/Material.Avalonia.Dialogs/Styles/EmbeddedDialogControl.axaml +++ b/Material.Avalonia.Dialogs/Styles/EmbeddedDialogControl.axaml @@ -25,7 +25,12 @@ Content="{CompiledBinding DialogIcon}" ContentTemplate="{StaticResource DialogHeaderIconTemplate}" IsVisible="{CompiledBinding !!DialogIcon}" /> - + + + + + + + + + + diff --git a/Material.Demo/Pages/CustomDialogContentDemo.axaml.cs b/Material.Demo/Pages/CustomDialogContentDemo.axaml.cs new file mode 100644 index 00000000..d76160b5 --- /dev/null +++ b/Material.Demo/Pages/CustomDialogContentDemo.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace Material.Demo.Pages; + +public partial class CustomDialogContentDemo : UserControl { + public CustomDialogContentDemo() { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/Material.Demo/ViewModels/DialogDemoViewModel.cs b/Material.Demo/ViewModels/DialogDemoViewModel.cs index dacbed51..519c3565 100644 --- a/Material.Demo/ViewModels/DialogDemoViewModel.cs +++ b/Material.Demo/ViewModels/DialogDemoViewModel.cs @@ -5,6 +5,7 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Media.Imaging; using Avalonia.Platform; +using Material.Demo.Pages; using Material.Dialog; using Material.Dialog.Enums; using Material.Dialog.Icons; @@ -31,7 +32,8 @@ public DialogDemoViewModel() { new DialogDemoItemViewModel("Login dialog", LoginDialog), new DialogDemoItemViewModel("Folder rename dialog", FolderNameDialog), new DialogDemoItemViewModel("Time picker", TimePickerDialog), - new DialogDemoItemViewModel("Date picker", DatePickerDialog) + new DialogDemoItemViewModel("Date picker", DatePickerDialog), + new DialogDemoItemViewModel("Custom dialog", CustomDialog), }; } @@ -267,5 +269,22 @@ private async IAsyncEnumerable DatePickerDialog() { yield return $"TimeSpan: {r.ToString("d")}"; _previousDatePickerResult = r; } + + private async IAsyncEnumerable CustomDialog() { + // Open asset stream using assets.Open method. + await using var icon = AssetLoader.Open(new Uri("avares://Material.Demo/Assets/avalonia-logo.png")); + + var dialog = DialogHelper.CreateCustomDialog(new CustomDialogBuilderParams() + { + Content = new CustomDialogContentDemo(), + StartupLocation = WindowStartupLocation.CenterOwner, + Borderless = false, + }); + + var result = await dialog.ShowDialog(_window); + + yield return $"Result: {result.GetResult}"; + } + } } \ No newline at end of file