@@ -39,22 +39,27 @@
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<ToggleSwitch
|
||||
Content="FullScreen"
|
||||
IsChecked="{Binding FullScreen}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Buttons" />
|
||||
<ComboBox ItemsSource="{Binding Buttons}" SelectedItem="{Binding SelectedButton}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="Buttons" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogButton}" Value="{Binding SelectedButton}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Mode" />
|
||||
<ComboBox ItemsSource="{Binding Modes}" SelectedItem="{Binding SelectedMode}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="Mode" />
|
||||
<u:EnumSelector EnumType="{x:Type u:DialogMode}" Value="{Binding SelectedMode}" />
|
||||
</StackPanel>
|
||||
<Button Command="{Binding ShowDialogCommand}" Content="Show Dialog" />
|
||||
<TextBlock>
|
||||
<Run Text="Default Result: " />
|
||||
<Run Text="{Binding DefaultResult}" />
|
||||
<Run Text="{Binding DefaultResult, FallbackValue=''}" />
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<Run Text="Dialog Date: " />
|
||||
<Run Text="{Binding Date}" />
|
||||
<Run Text="{Binding Date, FallbackValue=''}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
@@ -73,8 +78,8 @@
|
||||
OffContent="Local"
|
||||
OnContent="Global" />
|
||||
<ToggleSwitch
|
||||
Content="Modal/Regular"
|
||||
Name="modal"
|
||||
Content="Modal/Regular"
|
||||
IsChecked="{Binding IsModal}"
|
||||
OffContent="Regular"
|
||||
OnContent="Modal" />
|
||||
@@ -83,6 +88,11 @@
|
||||
IsChecked="{Binding CanLightDismiss}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<ToggleSwitch
|
||||
Content="FullScreen"
|
||||
IsChecked="{Binding FullScreen}"
|
||||
OffContent="No"
|
||||
OnContent="Yes" />
|
||||
<Button Command="{Binding ShowCustomDialogCommand}" Content="Show Dialog" />
|
||||
<TextBlock>
|
||||
<Run Text="Custom Result: " />
|
||||
|
||||
@@ -11,85 +11,28 @@ using Ursa.Demo.Pages;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class DialogDemoViewModel: ObservableObject
|
||||
public partial class DialogDemoViewModel: ObservableObject
|
||||
{
|
||||
public ICommand ShowDialogCommand { get; set; }
|
||||
public ICommand ShowCustomDialogCommand { get; set; }
|
||||
|
||||
private DialogMode _selectedMode;
|
||||
public DialogMode SelectedMode
|
||||
{
|
||||
get => _selectedMode;
|
||||
set => SetProperty(ref _selectedMode, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<DialogMode> Modes { get; set; }
|
||||
|
||||
private DialogButton _selectedButton;
|
||||
public DialogButton SelectedButton
|
||||
{
|
||||
get => _selectedButton;
|
||||
set => SetProperty(ref _selectedButton, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<DialogButton> Buttons { get; set; }
|
||||
|
||||
private bool _isWindow;
|
||||
public bool IsWindow
|
||||
{
|
||||
get => _isWindow;
|
||||
set => SetProperty(ref _isWindow, value);
|
||||
}
|
||||
|
||||
private bool _isGlobal;
|
||||
public bool IsGlobal
|
||||
{
|
||||
get => _isGlobal;
|
||||
set => SetProperty(ref _isGlobal, value);
|
||||
}
|
||||
|
||||
private bool _isModal;
|
||||
public bool IsModal
|
||||
{
|
||||
get => _isModal;
|
||||
set => SetProperty(ref _isModal, value);
|
||||
}
|
||||
|
||||
private bool _canLightDismiss;
|
||||
public bool CanLightDismiss
|
||||
{
|
||||
get => _canLightDismiss;
|
||||
set => SetProperty(ref _canLightDismiss, value);
|
||||
}
|
||||
|
||||
private DialogResult? _defaultResult;
|
||||
public DialogResult? DefaultResult
|
||||
{
|
||||
get => _defaultResult;
|
||||
set => SetProperty(ref _defaultResult, value);
|
||||
}
|
||||
|
||||
private bool _result;
|
||||
public bool Result
|
||||
{
|
||||
get => _result;
|
||||
set => SetProperty(ref _result, value);
|
||||
}
|
||||
|
||||
private DateTime? _date;
|
||||
public DateTime? Date
|
||||
{
|
||||
get => _date;
|
||||
set => SetProperty(ref _date, value);
|
||||
}
|
||||
|
||||
[ObservableProperty] private DialogMode _selectedMode;
|
||||
[ObservableProperty] private DialogButton _selectedButton;
|
||||
[ObservableProperty] private bool _isWindow;
|
||||
[ObservableProperty] private bool _isGlobal;
|
||||
[ObservableProperty] private bool _isModal;
|
||||
[ObservableProperty] private bool _canLightDismiss;
|
||||
[ObservableProperty] private DialogResult? _defaultResult;
|
||||
[ObservableProperty] private bool _result;
|
||||
[ObservableProperty] private DateTime? _date;
|
||||
[ObservableProperty] private bool _fullScreen;
|
||||
|
||||
public DialogDemoViewModel()
|
||||
{
|
||||
ShowDialogCommand = new AsyncRelayCommand(ShowDialog);
|
||||
ShowCustomDialogCommand = new AsyncRelayCommand(ShowCustomDialog);
|
||||
Modes = new ObservableCollection<DialogMode>(Enum.GetValues<DialogMode>());
|
||||
Buttons = new ObservableCollection<DialogButton>(Enum.GetValues<DialogButton>());
|
||||
IsModal = true;
|
||||
IsGlobal = true;
|
||||
}
|
||||
|
||||
private async Task ShowDialog()
|
||||
@@ -123,6 +66,7 @@ public class DialogDemoViewModel: ObservableObject
|
||||
HorizontalOffset = 50,
|
||||
VerticalAnchor = VerticalPosition.Top,
|
||||
VerticalOffset = 50,
|
||||
FullScreen = FullScreen,
|
||||
}
|
||||
);
|
||||
Date = vm.Date;
|
||||
@@ -138,6 +82,7 @@ public class DialogDemoViewModel: ObservableObject
|
||||
Mode = SelectedMode,
|
||||
Buttons = SelectedButton,
|
||||
CanLightDismiss = CanLightDismiss,
|
||||
FullScreen = FullScreen,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -149,7 +94,6 @@ public class DialogDemoViewModel: ObservableObject
|
||||
var vm = new DialogWithActionViewModel();
|
||||
if (IsWindow)
|
||||
{
|
||||
|
||||
if (IsModal)
|
||||
{
|
||||
Result = await Dialog.ShowCustomModal<DialogWithAction, DialogWithActionViewModel, bool>(
|
||||
@@ -161,7 +105,6 @@ public class DialogDemoViewModel: ObservableObject
|
||||
Dialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(
|
||||
vm);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -171,6 +114,7 @@ public class DialogDemoViewModel: ObservableObject
|
||||
vm, IsGlobal ? null : "LocalHost", options: new OverlayDialogOptions()
|
||||
{
|
||||
CanLightDismiss = CanLightDismiss,
|
||||
FullScreen = FullScreen,
|
||||
});
|
||||
Date = vm.Date;
|
||||
}
|
||||
@@ -178,7 +122,7 @@ public class DialogDemoViewModel: ObservableObject
|
||||
{
|
||||
OverlayDialog.ShowCustom<DialogWithAction, DialogWithActionViewModel>(new DialogWithActionViewModel(),
|
||||
IsGlobal ? null : "LocalHost",
|
||||
options: new OverlayDialogOptions{ CanLightDismiss = CanLightDismiss });
|
||||
options: new OverlayDialogOptions{ CanLightDismiss = CanLightDismiss, FullScreen = FullScreen});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ public partial class DrawerDemoViewModel: ObservableObject
|
||||
{
|
||||
ShowDialogCommand = new AsyncRelayCommand(ShowDefaultDialog);
|
||||
ShowCustomDialogCommand = new AsyncRelayCommand(ShowCustomDrawer);
|
||||
SelectedPosition = Position.Right;
|
||||
IsGlobal = true;
|
||||
IsModal = true;
|
||||
}
|
||||
|
||||
private async Task ShowDefaultDialog()
|
||||
|
||||
Reference in New Issue
Block a user