feat: implement multi layer dialog.
This commit is contained in:
@@ -7,10 +7,11 @@
|
||||
x:CompileBindings="True"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Dialogs.DialogWithAction">
|
||||
<StackPanel Margin="0 16 0 0">
|
||||
<TextBlock Text="{Binding Title}"></TextBlock>
|
||||
<StackPanel Margin="8">
|
||||
<TextBlock Classes="Strong" Margin="8" Text="{Binding Title}"></TextBlock>
|
||||
<Calendar SelectedDate="{Binding Date}" ></Calendar>
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Spacing="20">
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Spacing="8">
|
||||
<Button Content="Dialog" Command="{Binding DialogCommand}"></Button>
|
||||
<Button Content="OK" Command="{Binding OKCommand}"></Button>
|
||||
<Button Content="Cancel" Command="{Binding CancelCommand}"></Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
@@ -16,10 +17,13 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
public ICommand OKCommand { get; set; }
|
||||
public ICommand CancelCommand { get; set; }
|
||||
|
||||
public ICommand DialogCommand { get; set; }
|
||||
|
||||
public DialogWithActionViewModel()
|
||||
{
|
||||
OKCommand = new RelayCommand(OK);
|
||||
CancelCommand = new RelayCommand(Cancel);
|
||||
DialogCommand = new AsyncRelayCommand(ShowDialog);
|
||||
Title = "Please select a date";
|
||||
Date = DateTime.Now;
|
||||
}
|
||||
@@ -33,4 +37,9 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
{
|
||||
Closed?.Invoke(this, false);
|
||||
}
|
||||
|
||||
private async Task ShowDialog()
|
||||
{
|
||||
await DialogBox.ShowOverlayModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(new DialogWithActionViewModel(), "GlobalHost");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user