feat: add two tone icon.

This commit is contained in:
rabbitism
2024-01-27 03:47:54 +08:00
parent 2a5de69c89
commit ccc883d5f8
9 changed files with 173 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type u:TwoTonePathIcon}" TargetType="u:TwoTonePathIcon">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="{DynamicResource IconElementThemeHeight}" />
<Setter Property="Width" Value="{DynamicResource IconElementThemeWidth}" />
<Setter Property="StrokeThickness" Value="0.4" />
<Setter Property="Foreground" Value="{DynamicResource SemiBlue2}" />
<Setter Property="StrokeBrush" Value="{DynamicResource SemiBlue6}" />
<Setter Property="ActiveForeground" Value="{DynamicResource SemiBlue6}" />
<Setter Property="ActiveStrokeBrush" Value="{DynamicResource SemiBlue6}" />
<Setter Property="Template">
<ControlTemplate TargetType="u:TwoTonePathIcon">
<Border Background="{TemplateBinding Background}">
<Panel>
<Viewbox Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
<Path
Name="PART_Fill"
Data="{TemplateBinding Data}"
StrokeThickness="{TemplateBinding StrokeThickness}"
StrokeJoin="Round"
Fill="{TemplateBinding Foreground}"
Stroke="{TemplateBinding StrokeBrush}"
Stretch="Uniform" />
</Viewbox>
</Panel>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:active /template/ Path#PART_Fill">
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActiveForeground}" />
<Setter Property="Stroke" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActiveStrokeBrush}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@@ -19,5 +19,6 @@
<ResourceInclude Source="RangeSlider.axaml" />
<ResourceInclude Source="TagInput.axaml" />
<ResourceInclude Source="Timeline.axaml" />
<ResourceInclude Source="TwoTonePathIcon.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>