Files
Ursa.Avalonia/src/Ursa.Themes.Semi/Controls/Rating.axaml
Zhang Dian 0a30d01b7d feat: WIP.
2024-06-04 09:11:22 +08:00

81 lines
4.0 KiB
XML

<ResourceDictionary xmlns="https://github.com/avaloniaui"
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="Background" Value="{DynamicResource RatingCharacterUnSelectedForeground}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="u:RatingCharacter">
<!-- <Border Margin="0 0 6 0"> -->
<Canvas Width="24" Height="24">
<Path Width="24"
Height="24"
Data="{DynamicResource RatingStarIconGlyph}"
Fill="{TemplateBinding Background}" />
<Border Name="{x:Static u:RatingCharacter.PART_IconGlyph}"
IsVisible="True"
ClipToBounds="True">
<Path Width="24"
Height="24"
HorizontalAlignment="Left"
Data="{DynamicResource RatingStarIconGlyph}"
Fill="{TemplateBinding Foreground}" />
</Border>
</Canvas>
<!-- </Border> -->
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="RenderTransform" Value="scale(1.1)" />
</Style>
<Style Selector="^:selected">
<Setter Property="Foreground" Value="{DynamicResource RatingCharacterSelectedForeground}" />
</Style>
<Style Selector="^:half">
<!-- <Setter Property="Foreground"> -->
<!-- <LinearGradientBrush StartPoint="0%,0%" EndPoint="0%,100%"> -->
<!-- <GradientStop Color="#6b4c1b" Offset="0" /> -->
<!-- <GradientStop Color="#291e10" Offset="1" /> -->
<!-- </LinearGradientBrush> -->
<!-- </Setter> -->
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:Rating}" TargetType="u:Rating">
<Setter Property="Background" Value="Transparent" />
<Setter Property="ItemTemplate">
<DataTemplate>
<u:RatingCharacter />
</DataTemplate>
</Setter>
<Setter Property="Template">
<ControlTemplate TargetType="u:Rating">
<Border Name="PART_RootBorder"
MinHeight="30"
Padding="8,4"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel HorizontalAlignment="Stretch">
<ItemsControl Name="{x:Static u:Rating.PART_ItemsControl}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
ItemTemplate="{TemplateBinding ItemTemplate}"
ItemsSource="{TemplateBinding Items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>