A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

96 lines
5.3 KiB

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ControlCatalog.Pages.DrawerPageEventsPage">
<DockPanel>
<ScrollViewer DockPanel.Dock="Right" Width="260">
<StackPanel Margin="12" Spacing="8">
<TextBlock Text="Configuration" FontWeight="SemiBold" FontSize="16"
Foreground="{DynamicResource SystemControlHighlightAccentBrush}" />
<TextBlock Text="Actions" FontWeight="SemiBold" FontSize="13" />
<Button Content="Toggle Drawer"
HorizontalAlignment="Stretch"
Click="OnToggle" />
<Separator />
<CheckBox x:Name="CancelCheck"
Content="Cancel next close"
IsChecked="False"
ToolTip.Tip="When checked, the next Closing event will have Cancel=true, keeping the drawer open." />
<Separator />
<DockPanel>
<TextBlock DockPanel.Dock="Left" Text="Event Log" FontWeight="SemiBold" FontSize="13"
VerticalAlignment="Center" />
<Button DockPanel.Dock="Right" Content="Clear" Click="OnClearLog"
HorizontalAlignment="Right" Padding="8,2" FontSize="11" />
</DockPanel>
<Border Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"
CornerRadius="4" Padding="8" MinHeight="120" MaxHeight="300">
<TextBlock x:Name="EventLog"
Text=""
FontFamily="Cascadia Code,Consolas,Menlo,monospace"
FontSize="11"
TextWrapping="Wrap" />
</Border>
<Separator />
<TextBlock Text="Opened/Closing/Closed track the drawer open state. Closing supports cancellation. NavigatedTo/NavigatedFrom are page lifecycle events that fire when a page becomes or stops being the active page during navigation."
TextWrapping="Wrap" FontSize="12" Opacity="0.7" />
</StackPanel>
</ScrollViewer>
<Border DockPanel.Dock="Right" Width="1" Background="{DynamicResource SystemControlForegroundBaseMediumLowBrush}" />
<Border Margin="12"
BorderBrush="{DynamicResource SystemControlForegroundBaseMediumLowBrush}"
BorderThickness="1"
CornerRadius="6"
ClipToBounds="True">
<DrawerPage x:Name="DemoDrawer"
Header="Events"
DrawerLength="220">
<DrawerPage.DrawerHeader>
<Border Background="{DynamicResource SystemControlHighlightAccentBrush}" Padding="16,20">
<TextBlock Text="My App" FontSize="18" FontWeight="SemiBold" Foreground="White" />
</Border>
</DrawerPage.DrawerHeader>
<DrawerPage.Drawer>
<StackPanel Spacing="2" Margin="8">
<Button Tag="Home" Click="OnSelectSection"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Padding="12,10"
Background="Transparent">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Width="16" Height="16"
Data="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
<TextBlock Text="Home" VerticalAlignment="Center" />
</StackPanel>
</Button>
<Button Tag="Profile" Click="OnSelectSection"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Padding="12,10"
Background="Transparent">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Width="16" Height="16"
Data="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z" />
<TextBlock Text="Profile" VerticalAlignment="Center" />
</StackPanel>
</Button>
<Button Tag="Settings" Click="OnSelectSection"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" Padding="12,10"
Background="Transparent">
<StackPanel Orientation="Horizontal" Spacing="12">
<PathIcon Width="16" Height="16"
Data="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" />
<TextBlock Text="Settings" VerticalAlignment="Center" />
</StackPanel>
</Button>
</StackPanel>
</DrawerPage.Drawer>
<!-- Detail set in code-behind so lifecycle events are subscribed before the initial NavigatedTo fires. -->
</DrawerPage>
</Border>
</DockPanel>
</UserControl>