feat: Foreground.

This commit is contained in:
Zhang Dian
2024-06-07 11:04:06 +08:00
parent 34568a4af8
commit 0b72578de1
4 changed files with 5 additions and 6 deletions

View File

@@ -35,6 +35,7 @@
Value="{Binding Value}" Value="{Binding Value}"
Count="{Binding Count}" Count="{Binding Count}"
DefaultValue="{Binding DefaultValue}" DefaultValue="{Binding DefaultValue}"
Foreground="{StaticResource SemiRed5}"
Character="{StaticResource LoveHeartGeometry}" /> Character="{StaticResource LoveHeartGeometry}" />
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@@ -15,6 +15,7 @@
Data="{TemplateBinding Character}" Data="{TemplateBinding Character}"
Fill="{TemplateBinding Background}" /> Fill="{TemplateBinding Background}" />
<Border Name="{x:Static u:RatingCharacter.PART_IconGlyph}" <Border Name="{x:Static u:RatingCharacter.PART_IconGlyph}"
IsVisible="False"
ClipToBounds="True"> ClipToBounds="True">
<Path Width="24" <Path Width="24"
Height="24" Height="24"
@@ -30,15 +31,14 @@
<Style Selector="^:pointerover"> <Style Selector="^:pointerover">
<Setter Property="RenderTransform" Value="scale(1.1)" /> <Setter Property="RenderTransform" Value="scale(1.1)" />
</Style> </Style>
<Style Selector="^:selected"> <Style Selector="^:selected /template/ Border#PART_IconGlyph">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterForeground}" /> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="{x:Type u:Rating}" TargetType="u:Rating"> <ControlTheme x:Key="{x:Type u:Rating}" TargetType="u:Rating">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterUnSelectedForeground}" /> <Setter Property="Foreground" Value="{DynamicResource RatingCharacterForeground}" />
<Setter Property="Character" Value="{DynamicResource RatingStarIconGlyph}" /> <Setter Property="Character" Value="{DynamicResource RatingStarIconGlyph}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="ItemTemplate"> <Setter Property="ItemTemplate">
<DataTemplate> <DataTemplate>
<u:RatingCharacter /> <u:RatingCharacter />

View File

@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="RatingCharacterUnSelectedForeground" Color="Transparent" />
<SolidColorBrush x:Key="RatingCharacterForeground" Color="#FDDE43" /> <SolidColorBrush x:Key="RatingCharacterForeground" Color="#FDDE43" />
<SolidColorBrush x:Key="RatingCharacterBackground" Opacity="0.12" Color="White" /> <SolidColorBrush x:Key="RatingCharacterBackground" Opacity="0.12" Color="White" />
</ResourceDictionary> </ResourceDictionary>

View File

@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="RatingCharacterUnSelectedForeground" Color="Transparent" />
<SolidColorBrush x:Key="RatingCharacterForeground" Color="#FAC800" /> <SolidColorBrush x:Key="RatingCharacterForeground" Color="#FAC800" />
<SolidColorBrush x:Key="RatingCharacterBackground" Opacity="0.05" Color="#2E3238" /> <SolidColorBrush x:Key="RatingCharacterBackground" Opacity="0.05" Color="#2E3238" />
</ResourceDictionary> </ResourceDictionary>