feat: basic position.

This commit is contained in:
rabbitism
2024-02-05 19:40:11 +08:00
parent 8e085bc264
commit fd85efd895
13 changed files with 222 additions and 46 deletions

View File

@@ -5,11 +5,13 @@
mc:Ignorable="d" d:DesignWidth="800"
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels;assembly=Ursa.Demo"
xmlns:u="https://irihi.tech/ursa"
xmlns:common="clr-namespace:Ursa.Common;assembly=Ursa"
x:DataType="vm:DrawerDemoViewModel"
x:CompileBindings="True"
d:DesignHeight="450"
x:Class="Ursa.Demo.Pages.DrawerDemo">
<Canvas HorizontalAlignment="Left" Width="500">
<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>
</Canvas>
</StackPanel>
</UserControl>

View File

@@ -3,13 +3,18 @@ using System.Windows.Input;
using Avalonia.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Ursa.Common;
using Ursa.Controls;
using Ursa.Controls.Options;
namespace Ursa.Demo.ViewModels;
public class DrawerDemoViewModel: ObservableObject
public partial class DrawerDemoViewModel: ObservableObject
{
public ICommand OpenDrawerCommand { get; set; }
[ObservableProperty] private Position _selectedPosition;
public DrawerDemoViewModel()
{
@@ -18,6 +23,6 @@ public class DrawerDemoViewModel: ObservableObject
private async Task OpenDrawer()
{
await Drawer.Show<Calendar, string, bool>("Hello World");
await Drawer.ShowCustom<Calendar, string, bool>("Hello World", new CustomDrawerOptions() { Position = SelectedPosition, MinWidth = 400 });
}
}