Files
ShrlAlgoToolkit/NeuWPF/NeoUI/Controls/Pill.xaml
ShrlAlgo 955a01f564 整理
2025-08-20 12:10:35 +08:00

75 lines
4.0 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:NeoUI.Controls"
xmlns:nvd="clr-namespace:NeoUI.Controls.Decorations"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type controls:Pill}">
<Setter Property="Background" Value="{DynamicResource PrimaryVariantBrush}" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentPrimaryBrush}" />
<Setter Property="HeadBackground" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter Property="HeadForeground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Padding" Value="5,3" />
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Pill}">
<nvd:EmbossBorder
Margin="-4"
Padding="0"
CornerRadius="3"
ToolTip="{TemplateBinding Url}"
x:Name="rootBorder">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border
Background="{TemplateBinding HeadBackground}"
CornerRadius="3,0,0,3"
Padding="{TemplateBinding Padding}"
TextBlock.FontWeight="Bold"
TextBlock.Foreground="{TemplateBinding HeadForeground}"
x:Name="headBorder">
<ContentPresenter
ContentSource="Header"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<Border
Background="{TemplateBinding Background}"
CornerRadius="0,3,3,0"
Grid.Column="1"
Padding="{TemplateBinding Padding}"
TextBlock.FontWeight="Bold"
TextBlock.Foreground="{TemplateBinding Foreground}"
x:Name="contentBorder">
<ContentPresenter
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
</nvd:EmbossBorder>
<ControlTemplate.Triggers>
<Trigger Property="Url" Value="{x:Null}">
<Setter Property="Cursor" Value="Arrow" />
</Trigger>
<Trigger Property="Header" Value="{x:Null}">
<Setter Property="CornerRadius" TargetName="contentBorder" Value="3" />
<Setter Property="Padding" TargetName="headBorder" Value="0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>