feat: add flyout dynamic resource. Pending on Menu/MenuItem to add menu flyout theme.

This commit is contained in:
rabbitism 2022-12-22 01:36:14 +08:00
parent 8ad659cba6
commit 06ab6cd7d5
3 changed files with 30 additions and 10 deletions

View File

@ -3,18 +3,18 @@
<Setter Property="FlyoutPresenter.HorizontalContentAlignment" Value="Stretch" /> <Setter Property="FlyoutPresenter.HorizontalContentAlignment" Value="Stretch" />
<Setter Property="FlyoutPresenter.VerticalContentAlignment" Value="Stretch" /> <Setter Property="FlyoutPresenter.VerticalContentAlignment" Value="Stretch" />
<Setter Property="FlyoutPresenter.UseLayoutRounding" Value="False" /> <Setter Property="FlyoutPresenter.UseLayoutRounding" Value="False" />
<Setter Property="FlyoutPresenter.Background" Value="White" /> <Setter Property="FlyoutPresenter.Background" Value="{DynamicResource FlyoutBackground}" />
<Setter Property="FlyoutPresenter.BorderBrush" Value="#1A000000" /> <Setter Property="FlyoutPresenter.BorderBrush" Value="{DynamicResource FlyoutBorderBrush}" />
<Setter Property="FlyoutPresenter.BorderThickness" Value="0.5" /> <Setter Property="FlyoutPresenter.BorderThickness" Value="{DynamicResource FlyoutBorderThickness}" />
<Setter Property="FlyoutPresenter.Padding" Value="8" /> <Setter Property="FlyoutPresenter.Padding" Value="{DynamicResource FlyoutPadding}" />
<Setter Property="FlyoutPresenter.MinWidth" Value="100" /> <Setter Property="FlyoutPresenter.MinWidth" Value="{DynamicResource FlyoutMinWidth}" />
<Setter Property="FlyoutPresenter.MaxWidth" Value="600" /> <Setter Property="FlyoutPresenter.MaxWidth" Value="{DynamicResource FlyoutMaxWidth}" />
<Setter Property="FlyoutPresenter.MinHeight" Value="100" /> <Setter Property="FlyoutPresenter.MinHeight" Value="{DynamicResource FlyoutMinHeight}" />
<Setter Property="FlyoutPresenter.MaxHeight" Value="600" /> <Setter Property="FlyoutPresenter.MaxHeight" Value="{DynamicResource FlyoutMaxHeight}" />
<Setter Property="FlyoutPresenter.ClipToBounds" Value="False" /> <Setter Property="FlyoutPresenter.ClipToBounds" Value="False" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="FlyoutPresenter.CornerRadius" Value="4" /> <Setter Property="FlyoutPresenter.CornerRadius" Value="{DynamicResource FlyoutCornerRadius}" />
<Setter Property="FlyoutPresenter.Margin" Value="4" /> <Setter Property="FlyoutPresenter.Margin" Value="4" />
<Setter Property="FlyoutPresenter.Template"> <Setter Property="FlyoutPresenter.Template">
<ControlTemplate TargetType="FlyoutPresenter"> <ControlTemplate TargetType="FlyoutPresenter">
@ -23,7 +23,7 @@
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
BoxShadow="0 0 8 0 #1A000000" BoxShadow="{DynamicResource FlyoutBorderBoxShadow}"
ClipToBounds="False" ClipToBounds="False"
CornerRadius="{TemplateBinding CornerRadius}" CornerRadius="{TemplateBinding CornerRadius}"
UseLayoutRounding="False"> UseLayoutRounding="False">

View File

@ -0,0 +1,19 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=System.Runtime">
<SolidColorBrush x:Key="FlyoutBackground" Color="White" />
<SolidColorBrush
x:Key="FlyoutBorderBrush"
Opacity="0.08"
Color="#1C1F23" />
<Thickness x:Key="FlyoutBorderThickness">1</Thickness>
<BoxShadows x:Key="FlyoutBorderBoxShadow">0 0 8 0 #1A000000</BoxShadows>
<sys:Double x:Key="FlyoutMinHeight">100</sys:Double>
<sys:Double x:Key="FlyoutMinWidth">100</sys:Double>
<sys:Double x:Key="FlyoutMaxHeight">600</sys:Double>
<sys:Double x:Key="FlyoutMaxWidth">600</sys:Double>
<CornerRadius x:Key="FlyoutCornerRadius">6</CornerRadius>
<Thickness x:Key="FlyoutPadding">8</Thickness>
</ResourceDictionary>

View File

@ -16,5 +16,6 @@
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TextBox.axaml" /> <ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TextBox.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TreeView.axaml" /> <ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/TreeView.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Window.axaml" /> <ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Window.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Flyout.axaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>