feat: ultimate refactoring to separate default dialog and custom dialog.
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
x:CompileBindings="True"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Dialogs.DialogWithAction">
|
||||
<StackPanel Margin="8">
|
||||
<TextBlock Classes="Strong" Margin="8" Text="{Binding Title}"></TextBlock>
|
||||
<StackPanel Margin="24">
|
||||
<TextBlock FontSize="16" FontWeight="600" Margin="8" Text="{Binding Title}"></TextBlock>
|
||||
<Calendar SelectedDate="{Binding Date}" ></Calendar>
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Spacing="8">
|
||||
<Button Content="Dialog" Command="{Binding DialogCommand}"></Button>
|
||||
|
||||
@@ -11,7 +11,12 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
{
|
||||
[ObservableProperty] private string _title;
|
||||
[ObservableProperty] private DateTime _date;
|
||||
public object? DefaultCloseResult { get; set; } = true;
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Closed?.Invoke(this, false);
|
||||
}
|
||||
|
||||
public event EventHandler<object?>? Closed;
|
||||
|
||||
public ICommand OKCommand { get; set; }
|
||||
@@ -40,6 +45,6 @@ public partial class DialogWithActionViewModel: ObservableObject, IDialogContext
|
||||
|
||||
private async Task ShowDialog()
|
||||
{
|
||||
await OverlayDialog.ShowModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(new DialogWithActionViewModel());
|
||||
await OverlayDialog.ShowCustomModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(new DialogWithActionViewModel());
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Dialogs.PlainDialog">
|
||||
<StackPanel Margin="8">
|
||||
<TextBlock Classes="Strong" Margin="8" Text="{Binding Title}"></TextBlock>
|
||||
<Calendar SelectedDate="{Binding Date}" ></Calendar>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user