feat: add property Size.

This commit is contained in:
Zhang Dian
2024-06-07 18:09:36 +08:00
parent 8c53aea890
commit 9a79d7213c
6 changed files with 46 additions and 7 deletions

View File

@@ -5,11 +5,13 @@
<Setter Property="Character" Value="{DynamicResource RatingStarIconGlyph}" />
<Setter Property="Background" Value="{DynamicResource RatingCharacterBackground}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Margin" Value="3,4" />
<Setter Property="Margin" Value="{DynamicResource RatingCharacterMargin}" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="u:RatingCharacter">
<Canvas Name="PART_Root" Width="24" Height="24">
<Canvas Name="PART_Root"
Width="{TemplateBinding Size}"
Height="{TemplateBinding Size}">
<Path Width="{Binding #PART_Root.Width}"
Height="{Binding #PART_Root.Height}"
Stretch="Uniform"
@@ -39,6 +41,7 @@
<ControlTheme x:Key="{x:Type u:Rating}" TargetType="u:Rating">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterForeground}" />
<Setter Property="Character" Value="{DynamicResource RatingStarIconGlyph}" />
<Setter Property="Size" Value="{DynamicResource RatingDefaultSize}" />
<Setter Property="ItemTemplate">
<DataTemplate>
<u:RatingCharacter />
@@ -68,5 +71,8 @@
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^.Small">
<Setter Property="Size" Value="{DynamicResource RatingSmallSize}" />
</Style>
</ControlTheme>
</ResourceDictionary>