add Rate
This commit is contained in:
1 parent
7a6f293011
commit
95d19726eb
28 files changed
+634
-22
No files matched your search
@@ -0,0 +1,90 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Geometries.xaml"/>
|
||||
<ResourceDictionary Source="../../Basic/Converters.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="RateRateItemBaseStyle" TargetType="controls:RateItem">
|
||||
<Setter Property="Margin" Value="{Binding ItemMargin,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="Width" Value="{Binding ItemWidth,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="Height" Value="{Binding ItemHeight,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="AllowHalf" Value="{Binding AllowHalf,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="AllowClear" Value="{Binding AllowClear,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="Icon" Value="{Binding Icon,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="Background" Value="{Binding Background,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="Foreground" Value="{Binding Foreground,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:Rate}}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:RateItem">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="OnMouseEnter">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="CanvasRoot">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="1.1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="CanvasRoot">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="1.1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="OnMouseLeave">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="CanvasRoot">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="CanvasRoot">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Canvas x:Name="CanvasRoot" RenderTransformOrigin="0.5,0.5">
|
||||
<Canvas.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
</TransformGroup>
|
||||
</Canvas.RenderTransform>
|
||||
<Path Width="{Binding ActualWidth,ElementName=CanvasRoot}" Height="{Binding ActualHeight,ElementName=CanvasRoot}" Data="{TemplateBinding Icon}" Fill="{TemplateBinding Background}" Stretch="Uniform"/>
|
||||
<Border x:Name="PART_Icon" Visibility="Collapsed">
|
||||
<Path Width="{Binding ActualWidth,ElementName=CanvasRoot}" HorizontalAlignment="Left" Height="{Binding ActualHeight,ElementName=CanvasRoot}" Data="{TemplateBinding Icon}" Fill="{TemplateBinding Foreground}" Stretch="Uniform"/>
|
||||
</Border>
|
||||
</Canvas>
|
||||
<ControlTemplate.Triggers>
|
||||
<EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="CanvasRoot">
|
||||
<BeginStoryboard Storyboard="{StaticResource OnMouseEnter}"/>
|
||||
</EventTrigger>
|
||||
<EventTrigger RoutedEvent="UIElement.MouseLeave" SourceName="CanvasRoot">
|
||||
<BeginStoryboard Storyboard="{StaticResource OnMouseLeave}"/>
|
||||
</EventTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ItemsPanelTemplate x:Key="RateHorizontalItemsPanelTemplate">
|
||||
<UniformGrid Rows="1" Margin="-5,0"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="RateBaseStyle" TargetType="controls:Rate">
|
||||
<Setter Property="ItemMargin" Value="5,0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Setter Property="Icon" Value="{StaticResource StarGeometry}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource RateRateItemBaseStyle}"/>
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource RateHorizontalItemsPanelTemplate}"/>
|
||||
<Setter Property="Text" Value="{Binding Value,RelativeSource={RelativeSource Self},StringFormat={}{0:0.0}}"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:Rate">
|
||||
<StackPanel Background="Transparent" Orientation="Horizontal" x:Name="PART_Panel">
|
||||
<ItemsPresenter/>
|
||||
<TextBlock Visibility="{TemplateBinding ShowText,Converter={StaticResource Boolean2VisibilityConverter}}" Text="{TemplateBinding Text}" Margin="10,0,0,0" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/RateBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource RateBaseStyle}" TargetType="controls:Rate"/>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -48,6 +48,7 @@
|
||||
<ResourceDictionary Source="Tag.xaml"/>
|
||||
<ResourceDictionary Source="RadioGroup.xaml"/>
|
||||
<ResourceDictionary Source="FlipClock.xaml"/>
|
||||
<ResourceDictionary Source="Rate.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user