feat: optimize.

This commit is contained in:
Zhang Dian
2024-06-03 17:39:50 +08:00
parent ceede38804
commit f000c68597
5 changed files with 24 additions and 39 deletions

View File

@@ -2,29 +2,24 @@
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="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterDefaultForeground}" />
<Setter Property="Background" Value="{DynamicResource RatingCharacterDefaultBackground}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate TargetType="u:RatingCharacter">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<PathIcon Name="{x:Static u:RatingCharacter.PART_IconGlyph}"
Width="16"
Height="16"
Margin="4,0"
Data="{DynamicResource RatingStarUnSelectedIconGlyph}"
Foreground="{TemplateBinding Foreground}" />
<ToolTip.Tip>
<TextBlock Text="{Binding $parent[u:Rating].SelectedTooltip}" />
</ToolTip.Tip>
</Border>
<PathIcon Name="{x:Static u:RatingCharacter.PART_IconGlyph}"
Width="24"
Height="24"
Margin="0 0 6 0"
Data="{DynamicResource RatingStarIconGlyph}"
Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>
<Style Selector="^:selected /template/ PathIcon#PART_IconGlyph">
<Setter Property="Data" Value="{DynamicResource RatingStarSelectedIconGlyph}" />
<Style Selector="^:pointerover">
<Setter Property="RenderTransform" Value="scale(1.1)" />
</Style>
<Style Selector="^:selected">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterSelectedForeground}" />
</Style>
</ControlTheme>
@@ -32,7 +27,7 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="ItemTemplate">
<DataTemplate>
<u:RatingCharacter Content="{Binding}" />
<u:RatingCharacter />
</DataTemplate>
</Setter>
<Setter Property="Template">