feat: extract dynamic resources.
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<ControlTemplate TargetType="u:NavigationMenu">
|
<ControlTemplate TargetType="u:NavigationMenu">
|
||||||
<Border
|
<Border
|
||||||
Name="PART_RootBorder"
|
Name="PART_RootBorder"
|
||||||
Width="260"
|
Width="{DynamicResource NavigationMenuExpandWidth}"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
RowDefinitions="Auto, *, Auto, Auto">
|
RowDefinitions="Auto, *, Auto, Auto">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="12"
|
Margin="{DynamicResource NavigationMenuHeaderMargin}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_IconPresenter"
|
Name="PART_IconPresenter"
|
||||||
Margin="0,0,8,0"
|
Margin="{DynamicResource NavigationMenuIconMargin}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Content="{TemplateBinding Icon}" />
|
Content="{TemplateBinding Icon}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
@@ -61,15 +61,15 @@
|
|||||||
Theme="{DynamicResource ButtonToggleSwitch}">
|
Theme="{DynamicResource ButtonToggleSwitch}">
|
||||||
<ToggleSwitch.OnContent>
|
<ToggleSwitch.OnContent>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Width="{DynamicResource NavigationMenuExpandIconWidth}"
|
||||||
Height="16"
|
Height="{DynamicResource NavigationMenuExpandIconHeight}"
|
||||||
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||||
</ToggleSwitch.OnContent>
|
</ToggleSwitch.OnContent>
|
||||||
<ToggleSwitch.OffContent>
|
<ToggleSwitch.OffContent>
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Width="16"
|
Width="{DynamicResource NavigationMenuExpandIconWidth}"
|
||||||
Height="16"
|
Height="{DynamicResource NavigationMenuExpandIconHeight}"
|
||||||
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
Data="{DynamicResource NavigationMenuExpandIconGlyph}"
|
||||||
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||||
</ToggleSwitch.OffContent>
|
</ToggleSwitch.OffContent>
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<Setter Property="ContentPresenter.IsVisible" Value="False" />
|
<Setter Property="ContentPresenter.IsVisible" Value="False" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ Border#PART_RootBorder">
|
<Style Selector="^ /template/ Border#PART_RootBorder">
|
||||||
<Setter Property="Border.Width" Value="80" />
|
<Setter Property="Border.Width" Value="{DynamicResource NavigationMenuClosedWidth}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
|
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
|
||||||
<Setter Property="Grid.HorizontalAlignment" Value="Center" />
|
<Setter Property="Grid.HorizontalAlignment" Value="Center" />
|
||||||
@@ -99,10 +99,10 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Border
|
<Border
|
||||||
Name="PART_HeaderBorder"
|
Name="PART_HeaderBorder"
|
||||||
Margin="0,2"
|
Margin="{DynamicResource NavigationMenuItemDefaultMargin}"
|
||||||
Padding="8"
|
Padding="{DynamicResource NavigationMenuItemDefaultPadding}"
|
||||||
Background="{DynamicResource NavigationMenuItemDefaultBackground}"
|
Background="{DynamicResource NavigationMenuItemDefaultBackground}"
|
||||||
CornerRadius="6">
|
CornerRadius="{DynamicResource NavigationMenuItemDefaultCornerRadius}">
|
||||||
<Grid
|
<Grid
|
||||||
Name="PART_RootStackPanel"
|
Name="PART_RootStackPanel"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_IconPresenter"
|
Name="PART_IconPresenter"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
MinWidth="24"
|
MinWidth="{DynamicResource NavigationMenuItemIconMinWidth}"
|
||||||
Content="{TemplateBinding Icon}"
|
Content="{TemplateBinding Icon}"
|
||||||
ContentTemplate="{TemplateBinding IconTemplate}">
|
ContentTemplate="{TemplateBinding IconTemplate}">
|
||||||
<ContentPresenter.Margin>
|
<ContentPresenter.Margin>
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_HeaderPresenter"
|
Name="PART_HeaderPresenter"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Margin="12,0"
|
Margin="{DynamicResource NavigationMenuItemHeaderMargin}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
Content="{TemplateBinding Header}"
|
Content="{TemplateBinding Header}"
|
||||||
@@ -137,8 +137,8 @@
|
|||||||
<PathIcon
|
<PathIcon
|
||||||
Name="PART_ExpandIcon"
|
Name="PART_ExpandIcon"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Width="8"
|
Width="{DynamicResource NavigationMenuItemExpandIconWidth}"
|
||||||
Height="8"
|
Height="{DynamicResource NavigationMenuItemExpandIconHeight}"
|
||||||
Data="{DynamicResource NavigationMenuItemExpandIconGlyph}"
|
Data="{DynamicResource NavigationMenuItemExpandIconGlyph}"
|
||||||
Foreground="{DynamicResource NavigationMenuItemExpandIconForeground}">
|
Foreground="{DynamicResource NavigationMenuItemExpandIconForeground}">
|
||||||
<PathIcon.Transitions>
|
<PathIcon.Transitions>
|
||||||
@@ -181,18 +181,18 @@
|
|||||||
<ControlTemplate TargetType="u:NavigationMenuItem">
|
<ControlTemplate TargetType="u:NavigationMenuItem">
|
||||||
<Border
|
<Border
|
||||||
Name="PART_HeaderBorder"
|
Name="PART_HeaderBorder"
|
||||||
Margin="0,2"
|
Margin="{DynamicResource NavigationMenuItemDefaultMargin}"
|
||||||
Padding="8"
|
Padding="{DynamicResource NavigationMenuItemDefaultPadding}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Background="{DynamicResource NavigationMenuItemDefaultBackground}"
|
Background="{DynamicResource NavigationMenuItemDefaultBackground}"
|
||||||
CornerRadius="6"
|
CornerRadius="{DynamicResource NavigationMenuItemDefaultCornerRadius}"
|
||||||
ToolTip.ShowDelay="0"
|
ToolTip.ShowDelay="0"
|
||||||
ToolTip.Tip="{TemplateBinding Header}">
|
ToolTip.Tip="{TemplateBinding Header}">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_IconPresenter"
|
Name="PART_IconPresenter"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
MinWidth="24"
|
MinWidth="{DynamicResource NavigationMenuItemIconMinWidth}"
|
||||||
Margin="0"
|
Margin="{DynamicResource NavigationMenuItemIconMargin}"
|
||||||
Content="{TemplateBinding Icon}"
|
Content="{TemplateBinding Icon}"
|
||||||
ContentTemplate="{TemplateBinding IconTemplate}" />
|
ContentTemplate="{TemplateBinding IconTemplate}" />
|
||||||
</Border>
|
</Border>
|
||||||
@@ -212,22 +212,22 @@
|
|||||||
<Panel>
|
<Panel>
|
||||||
<Border
|
<Border
|
||||||
Name="PART_HeaderBorder"
|
Name="PART_HeaderBorder"
|
||||||
Margin="0,2"
|
Margin="{DynamicResource NavigationMenuItemDefaultMargin}"
|
||||||
Padding="8"
|
Padding="{DynamicResource NavigationMenuItemDefaultPadding}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Background="{DynamicResource NavigationMenuItemDefaultBackground}"
|
Background="{DynamicResource NavigationMenuItemDefaultBackground}"
|
||||||
CornerRadius="6">
|
CornerRadius="{DynamicResource NavigationMenuItemDefaultCornerRadius}">
|
||||||
<Grid HorizontalAlignment="Stretch" ColumnDefinitions="Auto, *, Auto">
|
<Grid HorizontalAlignment="Stretch" ColumnDefinitions="Auto, *, Auto">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_IconPresenter"
|
Name="PART_IconPresenter"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
MinWidth="24"
|
MinWidth="{DynamicResource NavigationMenuItemIconMinWidth}"
|
||||||
Content="{TemplateBinding Icon}"
|
Content="{TemplateBinding Icon}"
|
||||||
ContentTemplate="{TemplateBinding IconTemplate}" />
|
ContentTemplate="{TemplateBinding IconTemplate}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_HeaderPresenter"
|
Name="PART_HeaderPresenter"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="12,0"
|
Margin="{DynamicResource NavigationMenuItemHeaderMargin}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
Content="{TemplateBinding Header}"
|
Content="{TemplateBinding Header}"
|
||||||
@@ -236,9 +236,9 @@
|
|||||||
Converter={x:Static BoolConverters.Not}}" />
|
Converter={x:Static BoolConverters.Not}}" />
|
||||||
<PathIcon
|
<PathIcon
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Width="8"
|
Width="{DynamicResource NavigationMenuItemExpandIconWidth}"
|
||||||
Height="8"
|
Height="{DynamicResource NavigationMenuItemExpandIconHeight}"
|
||||||
Margin="12,0"
|
Margin="{DynamicResource NavigationMenuItemExpandIconMargin}"
|
||||||
Data="{DynamicResource NavigationMenuItemExpandIconGlyph}"
|
Data="{DynamicResource NavigationMenuItemExpandIconGlyph}"
|
||||||
Foreground="{DynamicResource NavigationMenuItemExpandIconForeground}"
|
Foreground="{DynamicResource NavigationMenuItemExpandIconForeground}"
|
||||||
IsVisible="{TemplateBinding IsTopLevelMenuItem,
|
IsVisible="{TemplateBinding IsTopLevelMenuItem,
|
||||||
@@ -259,7 +259,7 @@
|
|||||||
MinHeight="{DynamicResource MenuFlyoutMinHeight}"
|
MinHeight="{DynamicResource MenuFlyoutMinHeight}"
|
||||||
MaxWidth="{DynamicResource MenuFlyoutMaxWidth}"
|
MaxWidth="{DynamicResource MenuFlyoutMaxWidth}"
|
||||||
MaxHeight="{DynamicResource MenuFlyoutMaxHeight}"
|
MaxHeight="{DynamicResource MenuFlyoutMaxHeight}"
|
||||||
Margin="8"
|
Margin="{DynamicResource NavigationMenuItemFlyoutMargin}"
|
||||||
Padding="{DynamicResource MenuFlyoutPadding}"
|
Padding="{DynamicResource MenuFlyoutPadding}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Background="{DynamicResource MenuFlyoutBackground}"
|
Background="{DynamicResource MenuFlyoutBackground}"
|
||||||
@@ -287,8 +287,8 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^:not(:closed):collapsed /template/ ItemsPresenter#PART_ItemsPresenter">
|
<Style Selector="^:not(:closed):collapsed /template/ ItemsPresenter#PART_ItemsPresenter">
|
||||||
<Setter Property="ItemsPresenter.Height" Value="0" />
|
<Setter Property="ItemsPresenter.Height" Value="{DynamicResource NavigationMenuItemCollapsedHeight}" />
|
||||||
<Setter Property="ItemsPresenter.Opacity" Value="0" />
|
<Setter Property="ItemsPresenter.Opacity" Value="{DynamicResource NavigationMenuItemCollapsedOpacity}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:not(:empty):not(:collapsed) /template/ PathIcon#PART_ExpandIcon">
|
<Style Selector="^:not(:empty):not(:collapsed) /template/ PathIcon#PART_ExpandIcon">
|
||||||
<Setter Property="PathIcon.RenderTransform" Value="rotate(-180deg)" />
|
<Setter Property="PathIcon.RenderTransform" Value="rotate(-180deg)" />
|
||||||
@@ -301,10 +301,10 @@
|
|||||||
<ControlTheme x:Key="{x:Type u:NavigationMenuSeparator}" TargetType="u:NavigationMenuSeparator">
|
<ControlTheme x:Key="{x:Type u:NavigationMenuSeparator}" TargetType="u:NavigationMenuSeparator">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="u:NavigationMenuSeparator">
|
<ControlTemplate TargetType="u:NavigationMenuSeparator">
|
||||||
<StackPanel Name="PART_RootPanel" Margin="4,0">
|
<StackPanel Name="PART_RootPanel" Margin="{DynamicResource NavigationMenuSeparatorMargin}">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_HeaderPresenter"
|
Name="PART_HeaderPresenter"
|
||||||
Margin="4,0"
|
Margin="{DynamicResource NavigationMenuSeparatorHeaderMargin}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Content="{TemplateBinding Header}"
|
Content="{TemplateBinding Header}"
|
||||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||||
@@ -313,13 +313,13 @@
|
|||||||
Converter={x:Static ObjectConverters.IsNotNull}}">
|
Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||||
<ContentPresenter.Styles>
|
<ContentPresenter.Styles>
|
||||||
<Style Selector="TextBlock">
|
<Style Selector="TextBlock">
|
||||||
<Setter Property="FontSize" Value="12" />
|
<Setter Property="FontSize" Value="{DynamicResource NavigationMenuSeparatorHeaderFontSize}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ContentPresenter.Styles>
|
</ContentPresenter.Styles>
|
||||||
</ContentPresenter>
|
</ContentPresenter>
|
||||||
<Rectangle
|
<Rectangle
|
||||||
Height="1"
|
Height="{DynamicResource NavigationMenuSeparatorBorderHeight}"
|
||||||
Margin="0,2"
|
Margin="{DynamicResource NavigationMenuSeparatorBorderMargin}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Fill="{DynamicResource SemiColorBorder}" />
|
Fill="{DynamicResource SemiColorBorder}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -327,7 +327,7 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:closed /template/ StackPanel#PART_RootPanel">
|
<Style Selector="^:closed /template/ StackPanel#PART_RootPanel">
|
||||||
<Setter Property="StackPanel.HorizontalAlignment" Value="Center" />
|
<Setter Property="StackPanel.HorizontalAlignment" Value="Center" />
|
||||||
<Setter Property="StackPanel.Width" Value="32" />
|
<Setter Property="StackPanel.Width" Value="{DynamicResource NavigationMenuSeparatorClosedWidth}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:closed /template/ ContentPresenter#PART_HeaderPresenter">
|
<Style Selector="^:closed /template/ ContentPresenter#PART_HeaderPresenter">
|
||||||
<Setter Property="ContentPresenter.IsVisible" Value="False" />
|
<Setter Property="ContentPresenter.IsVisible" Value="False" />
|
||||||
|
|||||||
@@ -1,4 +1,36 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:sys="clr-namespace:System;assembly=netstandard">
|
||||||
<Geometry x:Key="NavigationMenuExpandIconGlyph">M5 2H19C20.6569 2 22 3.34315 22 5V19C22 20.6569 20.6569 22 19 22H5C3.34315 22 2 20.6569 2 19V5C2 3.34315 3.34315 2 5 2ZM6 4C5.44772 4 5 4.44772 5 5V19C5 19.5523 5.44772 20 6 20H9C9.55229 20 10 19.5523 10 19V5C10 4.44772 9.55229 4 9 4H6Z</Geometry>
|
<Geometry x:Key="NavigationMenuExpandIconGlyph">M5 2H19C20.6569 2 22 3.34315 22 5V19C22 20.6569 20.6569 22 19 22H5C3.34315 22 2 20.6569 2 19V5C2 3.34315 3.34315 2 5 2ZM6 4C5.44772 4 5 4.44772 5 5V19C5 19.5523 5.44772 20 6 20H9C9.55229 20 10 19.5523 10 19V5C10 4.44772 9.55229 4 9 4H6Z</Geometry>
|
||||||
<Geometry x:Key="NavigationMenuItemExpandIconGlyph">M4.08045 7.59809C4.66624 7.01231 5.61599 7.01231 6.20177 7.59809L11.8586 13.2549L17.5155 7.59809C18.1013 7.01231 19.051 7.01231 19.6368 7.59809C20.2226 8.18388 20.2226 9.13363 19.6368 9.71941L12.9193 16.4369C12.3335 17.0227 11.3838 17.0227 10.798 16.4369L4.08045 9.71941C3.49467 9.13363 3.49467 8.18388 4.08045 7.59809Z</Geometry>
|
<Geometry x:Key="NavigationMenuItemExpandIconGlyph">M4.08045 7.59809C4.66624 7.01231 5.61599 7.01231 6.20177 7.59809L11.8586 13.2549L17.5155 7.59809C18.1013 7.01231 19.051 7.01231 19.6368 7.59809C20.2226 8.18388 20.2226 9.13363 19.6368 9.71941L12.9193 16.4369C12.3335 17.0227 11.3838 17.0227 10.798 16.4369L4.08045 9.71941C3.49467 9.13363 3.49467 8.18388 4.08045 7.59809Z</Geometry>
|
||||||
|
|
||||||
|
<sys:Double x:Key="NavigationMenuExpandWidth">260</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuClosedWidth">80</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuExpandIconWidth">16</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuExpandIconHeight">16</sys:Double>
|
||||||
|
|
||||||
|
<sys:Double x:Key="NavigationMenuItemIconMinWidth">24</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuItemExpandIconWidth">8</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuItemExpandIconHeight">8</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuItemIconMargin">0</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuItemCollapsedHeight">0</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuItemCollapsedOpacity">0</sys:Double>
|
||||||
|
|
||||||
|
<sys:Double x:Key="NavigationMenuSeparatorHeaderFontSize">12</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuSeparatorBorderHeight">1</sys:Double>
|
||||||
|
<sys:Double x:Key="NavigationMenuSeparatorClosedWidth">32</sys:Double>
|
||||||
|
|
||||||
|
|
||||||
|
<Thickness x:Key="NavigationMenuHeaderMargin">12</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuIconMargin">0,0,8,0</Thickness>
|
||||||
|
|
||||||
|
<Thickness x:Key="NavigationMenuItemDefaultMargin">0,2</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuItemDefaultPadding">8</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuItemDefaultCornerRadius">6</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuItemHeaderMargin">12,0</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuItemExpandIconMargin">12,0</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuItemFlyoutMargin">8</Thickness>
|
||||||
|
|
||||||
|
<Thickness x:Key="NavigationMenuSeparatorMargin">4,0</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuSeparatorHeaderMargin">4,0</Thickness>
|
||||||
|
<Thickness x:Key="NavigationMenuSeparatorBorderMargin">0,2</Thickness>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
Reference in New Issue
Block a user