feat: add pseudo classes.

This commit is contained in:
rabbitism
2024-02-12 15:49:01 +08:00
parent bc9412aad2
commit f9802d222b
5 changed files with 185 additions and 26 deletions

View File

@@ -1,17 +1,18 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme TargetType="u:NavMenu" x:Key="{x:Type u:NavMenu}">
<Setter Property="Grid.IsSharedSizeScope" Value="True"></Setter>
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:NavMenu}" TargetType="u:NavMenu">
<Setter Property="Grid.IsSharedSizeScope" Value="True" />
<Setter Property="Template">
<ControlTemplate TargetType="u:NavMenu">
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" Grid.IsSharedSizeScope="True"/>
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" />
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme TargetType="u:NavMenuItem" x:Key="{x:Type u:NavMenuItem}">
<ControlTheme x:Key="{x:Type u:NavMenuItem}" TargetType="u:NavMenuItem">
<Setter Property="Template">
<ControlTemplate TargetType="u:NavMenuItem">
<Grid RowDefinitions="Auto, *">
@@ -20,10 +21,20 @@
<ColumnDefinition Width="Auto" SharedSizeGroup="Icon" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Content="{TemplateBinding Icon}" HorizontalAlignment="Left" />
<ContentPresenter Grid.Column="1" Content="{TemplateBinding Header}" />
<ContentPresenter
HorizontalAlignment="Left"
Background="Aqua"
Content="{TemplateBinding Icon}" />
<ContentPresenter
Grid.Column="1"
Background="LightYellow"
Content="{TemplateBinding Header}" />
</Grid>
<ItemsPresenter Grid.Row="1" ItemsPanel="{TemplateBinding ItemsPanel}" />
<ItemsPresenter
Grid.Row="1"
Margin="20,0,0,0"
Grid.IsSharedSizeScope="True"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</Grid>
</ControlTemplate>
</Setter>