DialogControl 增加 ShowCustom 方法

This commit is contained in:
idea-zone
2024-02-01 08:53:50 +08:00
committed by bug320
parent 6ec1c477c4
commit 4dc0fd9e0c
3 changed files with 54 additions and 4 deletions

View File

@@ -56,7 +56,7 @@
<StackPanel>
<ToggleSwitch Content="Window/Overlay" OffContent="Overlay" OnContent="Window" IsChecked="{Binding IsWindow}" Name="overlay2" />
<ToggleSwitch Content="Global/Local" IsVisible="{Binding !#overlay2.IsChecked}" OffContent="Local" OnContent="Global" IsChecked="{Binding IsGlobal}" />
<ToggleSwitch Content="Modal/Regular" IsVisible="{Binding !#overlay2.IsChecked}" OffContent="Regular" OnContent="Modal" IsChecked="{Binding IsModal}" />
<ToggleSwitch Content="Modal/Regular" OffContent="Regular" OnContent="Modal" IsChecked="{Binding IsModal}" />
<Button Content="Show Dialog" Command="{Binding ShowCustomDialogCommand}" />
<TextBlock>
<Run Text="Custom Result: "></Run>

View File

@@ -128,10 +128,19 @@ public class DialogDemoViewModel: ObservableObject
var vm = new DialogWithActionViewModel();
if (IsWindow)
{
if (IsModal)
{
Result = await Dialog.ShowCustomModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(
vm);
Date = vm.Date;
}
else
{
Dialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(
vm);
}
Result = await Dialog.ShowCustomModalAsync<DialogWithAction, DialogWithActionViewModel, bool>(
vm);
Date = vm.Date;
}
else
{