feat: add property Character.

This commit is contained in:
Zhang Dian
2024-06-07 10:52:35 +08:00
parent e5628f7f23
commit 34568a4af8
5 changed files with 48 additions and 25 deletions

View File

@@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<ControlTheme x:Key="{x:Type u:RatingCharacter}" TargetType="u:RatingCharacter">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterUnSelectedForeground}" />
<Setter Property="Character" Value="{DynamicResource RatingStarIconGlyph}" />
<Setter Property="Background" Value="{DynamicResource RatingCharacterBackground}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
@@ -12,14 +12,14 @@
<Canvas Width="24" Height="24">
<Path Width="24"
Height="24"
Data="{DynamicResource RatingStarIconGlyph}"
Data="{TemplateBinding Character}"
Fill="{TemplateBinding Background}" />
<Border Name="{x:Static u:RatingCharacter.PART_IconGlyph}"
ClipToBounds="True">
<Path Width="24"
Height="24"
HorizontalAlignment="Left"
Data="{DynamicResource RatingStarIconGlyph}"
Data="{TemplateBinding Character}"
Fill="{TemplateBinding Foreground}" />
</Border>
</Canvas>
@@ -36,6 +36,8 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type u:Rating}" TargetType="u:Rating">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterUnSelectedForeground}" />
<Setter Property="Character" Value="{DynamicResource RatingStarIconGlyph}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="ItemTemplate">
<DataTemplate>
@@ -45,8 +47,6 @@
<Setter Property="Template">
<ControlTemplate TargetType="u:Rating">
<Border Name="PART_RootBorder"
MinHeight="30"
Padding="8,4"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"