Files
WCS/Cowain.TestProject/Assets/Styles.axaml
2026-03-02 09:08:20 +08:00

112 lines
4.5 KiB
XML

<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Border Padding="20">
<!-- Add Controls for Previewer Here -->
</Border>
</Design.PreviewWith>
<Style Selector="Border.Rounded-1">
<Setter Property="CornerRadius" Value="5" />
</Style>
<Style Selector="Border.Rounded-2">
<Setter Property="CornerRadius" Value="10" />
</Style>
<Style Selector="Button.BtnPrimary">
<Setter Property="Background" Value="{DynamicResource BtnPrimary}" />
</Style>
<!--文本块-->
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
</Style>
<!-- 工具栏 -->
<Style Selector="Button.ToolbarIconButton">
<Setter Property="Margin" Value="10" />
<Setter Property="Width" Value="60" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource BtnDefaultHover}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource BtnDefaultActive}" />
</Style>
</Style>
<Style Selector="Button.ToolbarIconButton.Active">
<Setter Property="Background" Value="{DynamicResource BtnDefaultActive}" />
</Style>
<Style Selector="Button.ToolbarIconButton PathIcon">
<Setter Property="Foreground" Value="{DynamicResource TextPrimary}" />
<Setter Property="Margin" Value="4" />
</Style>
<Style Selector="Button.ToolbarIconButton TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<!--侧边栏搜索框-->
<Style Selector="TextBox.Search">
<Setter Property="Background" Value="{DynamicResource BgSearchInput}" />
<Setter Property="BorderBrush" Value="{DynamicResource BgSearchInput}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Padding" Value="10" />
<!--
覆盖默认 TextBox 样式,原结构可参考以下网址
https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
-->
<Style Selector="^:pointerover">
<Style Selector="^ /template/ Border#PART_BorderElement">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{DynamicResource BgSearchInput}" />
</Style>
</Style>
<Style Selector="^:focus">
<Style Selector="^ /template/ Border#PART_BorderElement">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{DynamicResource BgSearchInput}" />
</Style>
</Style>
</Style>
<!--侧边栏二级菜单样式-->
<Style Selector="TextBlock.SidebarGroupName">
<Setter Property="Width" Value="190" />
<Setter Property="TextWrapping" Value="NoWrap" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Padding" Value="10,0,0,10" />
</Style>
<Style Selector="Button.SidebarMenuItem">
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource BgSidebarItemHover}" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource BgSidebarItemPressed}" />
</Style>
</Style>
<Style Selector="Button.SidebarMenuItem.Active">
<Setter Property="Background" Value="{DynamicResource BgSidebarItemPressed}" />
</Style>
<Style Selector="Button.SidebarMenuItem PathIcon">
<Setter Property="Margin" Value="0,0,6,0" />
<Setter Property="Width" Value="18" />
<Setter Property="Height" Value="18" />
</Style>
<Style Selector="Button.SidebarMenuItem TextBlock">
<Setter Property="Width" Value="142" />
<Setter Property="Padding" Value="5" />
<Setter Property="TextWrapping" Value="NoWrap" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
</Styles>