feat: add default template, add sample.

This commit is contained in:
rabbitism
2024-02-05 22:21:20 +08:00
parent 36c63b6326
commit ea4ce2cd06
4 changed files with 175 additions and 0 deletions

View File

@@ -13,5 +13,6 @@
<StackPanel HorizontalAlignment="Left" >
<u:EnumSelector EnumType="{x:Type common:Position}" Value="{Binding SelectedPosition}"></u:EnumSelector>
<Button Content="Call Drawer" HorizontalAlignment="Stretch" Command="{Binding OpenDrawerCommand}"></Button>
<Button Content="Default Drawer" Command="{Binding OpenDefaultDrawerCommand}"></Button>
</StackPanel>
</UserControl>

View File

@@ -13,6 +13,7 @@ namespace Ursa.Demo.ViewModels;
public partial class DrawerDemoViewModel: ObservableObject
{
public ICommand OpenDrawerCommand { get; set; }
public ICommand OpenDefaultDrawerCommand { get; set; }
[ObservableProperty] private Position _selectedPosition;
@@ -20,6 +21,19 @@ public partial class DrawerDemoViewModel: ObservableObject
public DrawerDemoViewModel()
{
OpenDrawerCommand = new AsyncRelayCommand(OpenDrawer);
OpenDefaultDrawerCommand = new AsyncRelayCommand(OpenDefaultDrawer);
SelectedPosition = Position.Right;
}
private Task OpenDefaultDrawer()
{
return Drawer.Show<PlainDialog, PlainDialogViewModel, bool>(new PlainDialogViewModel(), new DefaultDrawerOptions()
{
Buttons = DialogButton.OKCancel,
Position = SelectedPosition,
Title = "Please select a date",
CanClickOnMaskToClose = false,
});
}
private async Task OpenDrawer()