feat: add active class to path icon.
This commit is contained in:
parent
53b468db4a
commit
1a2628eff0
22
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml
Normal file
22
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml
Normal file
@ -0,0 +1,22 @@
|
||||
<UserControl
|
||||
x:Class="Semi.Avalonia.Demo.Pages.PathIconDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left" >
|
||||
<TextBlock Text="Size"></TextBlock>
|
||||
<Slider Name="width" Minimum="0" Maximum="100" Value="20" Width="300"></Slider>
|
||||
<ToggleSwitch Name="active" Content="Active"></ToggleSwitch>
|
||||
<PathIcon
|
||||
Classes.Active="{Binding ElementName=active, Path=IsChecked}"
|
||||
BorderBrush="{DynamicResource SemiRed6}"
|
||||
Width="{Binding #width.Value}"
|
||||
Height="{Binding #width.Value}"
|
||||
Data="M12 3L2 12H5V20H19V12H22L12 3M13 18H11V16H13V18M13 14H11V8H13V14Z"
|
||||
Foreground="{DynamicResource SemiBlue6}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
13
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml.cs
Normal file
13
demo/Semi.Avalonia.Demo/Pages/IconDemo.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class PathIconDemo : UserControl
|
||||
{
|
||||
public PathIconDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
@ -144,6 +144,9 @@
|
||||
<TabItem Header="NumericUpDown">
|
||||
<pages:NumericUpDownDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="PathIcon">
|
||||
<pages:PathIconDemo/>
|
||||
</TabItem>
|
||||
<TabItem Header="ProgressBar">
|
||||
<pages:ProgressBarDemo />
|
||||
</TabItem>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<Viewbox Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
|
||||
<Path
|
||||
Name="PART_Path"
|
||||
Data="{TemplateBinding Data}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Stretch="Uniform" />
|
||||
@ -18,5 +19,8 @@
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^.Active /template/ Path#PART_Path">
|
||||
<Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}"></Setter>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user