Files
aistudio-wpf-diagram/Others/Fluent.Ribbon/Fluent.Ribbon/Themes/Controls/ComboBoxItem.xaml
2023-04-16 20:11:40 +08:00

42 lines
2.3 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Fluent="clr-namespace:Fluent">
<ControlTemplate TargetType="{x:Type ComboBoxItem}"
x:Key="ComboBoxItemTemplate">
<Grid Background="Transparent">
<Grid Margin="0 0.5"
Background="{TemplateBinding Background}">
<Border x:Name="ItemBackground"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
IsHitTestVisible="False"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBackground" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.Pressed.Background}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ItemBackground" Property="Background" Value="{DynamicResource Fluent.Ribbon.Brushes.Button.MouseOver.Background}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="ComboBoxItemStyle"
TargetType="{x:Type ComboBoxItem}">
<Setter Property="Padding"
Value="3" />
<Setter Property="Template"
Value="{DynamicResource ComboBoxItemTemplate}" />
</Style>
</ResourceDictionary>