pschelpdesk/Shared/IconPack/IconControl.axaml
2024-11-11 09:07:13 +01:00

37 lines
1.5 KiB
XML

<Styles xmlns:iconPack="clr-namespace:PSCHelpdesk.Shared"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Border Padding="20">
<iconPack:IconControl Width="20" Height="20" Background="Red" Foreground="Blue" Kind="PackIconEntypoKind.Calendar" />
</Border>
</Design.PreviewWith>
<Style Selector="iconPack|IconControl">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate TargetType="iconPack:IconControl">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid x:Name="PART_InnerGrid"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding BorderThickness}">
<Viewbox Margin="{TemplateBinding Padding}">
<Path x:Name="PART_IconPath"
Stretch="Uniform"
UseLayoutRounding="False"
Fill="{TemplateBinding Foreground}"
Data="{Binding IconData, RelativeSource={RelativeSource Mode=TemplatedParent}}"
/>
</Viewbox>
</Grid>
</Border>
</ControlTemplate>
</Setter>
</Style>
</Styles>