2025-08-20 12:10:35 +08:00
|
|
|
<ResourceDictionary
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2026-02-20 15:31:44 +08:00
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
2026-01-02 17:30:41 +08:00
|
|
|
xmlns:controls="clr-namespace:Melskin.Controls"
|
2026-02-20 15:31:44 +08:00
|
|
|
xmlns:internal="clr-namespace:Melskin.Converters.Internal">
|
2025-12-23 21:35:54 +08:00
|
|
|
<ResourceDictionary.MergedDictionaries>
|
2026-01-02 17:30:41 +08:00
|
|
|
<ResourceDictionary Source="/Melskin;component/Themes/Fonts.xaml" />
|
2025-12-23 21:35:54 +08:00
|
|
|
</ResourceDictionary.MergedDictionaries>
|
2025-08-20 12:10:35 +08:00
|
|
|
|
|
|
|
|
<!-- DataTemplates -->
|
|
|
|
|
<DataTemplate x:Key="MaterialTemplate">
|
|
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2025-08-20 12:10:35 +08:00
|
|
|
FontFamily="{Binding FontFamily, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
Text="{Binding Symbol, RelativeSource={RelativeSource AncestorType=controls:IconElement}, Converter={x:Static internal:SymbolToCharConverter.Instance}}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
|
|
<DataTemplate x:Key="GlyphTemplate">
|
|
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2025-08-20 12:10:35 +08:00
|
|
|
FontFamily="{Binding FontFamily, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
Text="{Binding Glyph, RelativeSource={RelativeSource AncestorType=controls:IconElement}}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
|
|
<DataTemplate x:Key="ImageTemplate">
|
|
|
|
|
<Image
|
|
|
|
|
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2025-08-20 12:10:35 +08:00
|
|
|
SnapsToDevicePixels="True"
|
|
|
|
|
Source="{Binding ImageSource, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
Stretch="{Binding ImageStretch, RelativeSource={RelativeSource AncestorType=controls:IconElement}}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
|
|
<DataTemplate x:Key="GeometryTemplate">
|
|
|
|
|
<Viewbox
|
|
|
|
|
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
Stretch="Uniform">
|
2025-08-20 12:10:35 +08:00
|
|
|
<Path
|
|
|
|
|
Data="{Binding Geometry, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
Fill="{Binding GeometryFill, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
Stretch="Uniform"
|
|
|
|
|
Stroke="{Binding GeometryStroke, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
StrokeThickness="{Binding GeometryStrokeThickness, RelativeSource={RelativeSource AncestorType=controls:IconElement}}" />
|
|
|
|
|
</Viewbox>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
|
|
<DataTemplate x:Key="DrawingTemplate">
|
|
|
|
|
<Image
|
|
|
|
|
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2025-08-20 12:10:35 +08:00
|
|
|
Source="{Binding DrawingImage, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
Stretch="Uniform" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
|
|
<DataTemplate x:Key="DrawingBrushTemplate">
|
|
|
|
|
<Viewbox
|
|
|
|
|
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType=controls:IconElement}}"
|
|
|
|
|
Stretch="Uniform">
|
2025-08-20 12:10:35 +08:00
|
|
|
<Rectangle
|
2026-02-20 15:31:44 +08:00
|
|
|
Width="24"
|
2025-08-20 12:10:35 +08:00
|
|
|
Height="24"
|
2026-02-20 15:31:44 +08:00
|
|
|
Fill="{Binding DrawingBrush, RelativeSource={RelativeSource AncestorType=controls:IconElement}}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</Viewbox>
|
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
|
|
<!-- 样式 -->
|
2026-02-20 15:31:44 +08:00
|
|
|
<Style x:Key="IconElementStyle" TargetType="{x:Type controls:IconElement}">
|
2025-08-20 12:10:35 +08:00
|
|
|
<Setter Property="FontFamily" Value="{StaticResource MaterialIconFont}" />
|
|
|
|
|
<Setter Property="FontSize" Value="16" />
|
2025-09-08 19:49:09 +08:00
|
|
|
<Setter Property="Padding" Value="0" />
|
2025-12-23 21:35:54 +08:00
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
2025-08-20 12:10:35 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
|
|
|
<Setter Property="Focusable" Value="False" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:IconElement}">
|
2025-12-23 21:35:54 +08:00
|
|
|
<ContentPresenter
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="PART_Content"
|
2025-12-23 21:35:54 +08:00
|
|
|
Margin="{TemplateBinding Padding}"
|
2026-02-20 15:31:44 +08:00
|
|
|
Focusable="False" />
|
2025-08-20 12:10:35 +08:00
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="controls:IconElement.EffectiveContentType" Value="Material">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="ContentTemplate" Value="{StaticResource MaterialTemplate}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="controls:IconElement.EffectiveContentType" Value="Glyph">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="ContentTemplate" Value="{StaticResource GlyphTemplate}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="controls:IconElement.EffectiveContentType" Value="Image">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="ContentTemplate" Value="{StaticResource ImageTemplate}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="controls:IconElement.EffectiveContentType" Value="Geometry">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="ContentTemplate" Value="{StaticResource GeometryTemplate}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<!-- Drawing (没有 Brush) -->
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
|
<Condition Property="controls:IconElement.EffectiveContentType" Value="Drawing" />
|
|
|
|
|
<Condition Property="DrawingBrush" Value="{x:Null}" />
|
|
|
|
|
</MultiTrigger.Conditions>
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="ContentTemplate" Value="{StaticResource DrawingTemplate}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</MultiTrigger>
|
|
|
|
|
<!-- DrawingBrush 优先 -->
|
|
|
|
|
<MultiTrigger>
|
|
|
|
|
<MultiTrigger.Conditions>
|
|
|
|
|
<Condition Property="controls:IconElement.EffectiveContentType" Value="Brush" />
|
|
|
|
|
</MultiTrigger.Conditions>
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="ContentTemplate" Value="{StaticResource DrawingBrushTemplate}" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</MultiTrigger>
|
|
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PART_Content" Property="Opacity" Value="0.55" />
|
2025-08-20 12:10:35 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<!-- 默认引用 -->
|
|
|
|
|
<Style BasedOn="{StaticResource IconElementStyle}" TargetType="{x:Type controls:IconElement}" />
|
2025-09-08 19:49:09 +08:00
|
|
|
|
|
|
|
|
<Style
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Key="ToolIcon"
|
2025-09-08 19:49:09 +08:00
|
|
|
BasedOn="{StaticResource IconElementStyle}"
|
2026-02-20 15:31:44 +08:00
|
|
|
TargetType="controls:IconElement">
|
2025-09-08 19:49:09 +08:00
|
|
|
<!-- <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" /> -->
|
|
|
|
|
<!-- <Setter Property="FontSize" Value="16" /> -->
|
|
|
|
|
<Setter Property="Opacity" Value="0.65" />
|
|
|
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
|
|
|
<Style.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Opacity" Value="0.85" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
</Style.Triggers>
|
|
|
|
|
</Style>
|
2025-08-20 12:10:35 +08:00
|
|
|
</ResourceDictionary>
|