add CoverView

This commit is contained in:
NaBian committed 2019-01-02 18:48:30 +08:00
1 parent 912a10b56d
commit ad6083fe78
32 files changed
+703 -36

No files matched your search

@@ -3,11 +3,72 @@
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="CoverViewItemBaseStyle" TargetType="controls:CoverViewItem">
<Setter Property="Margin" Value="{Binding ItemMargin,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:CoverView}}"/>
<Setter Property="Width" Value="{Binding ItemWidth,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:CoverView}}"/>
<Setter Property="Height" Value="{Binding ItemHeight,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:CoverView}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CoverViewItem">
<Border BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter ContentSource="Header" Margin="{TemplateBinding Padding}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CoverViewContentBaseStyle" TargetType="controls:CoverViewContent">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Margin" Value="0,0,0,8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CoverViewContent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="16"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="PART_Triangle" Visibility="Visible" Grid.Row="0" Width="30" Height="30" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.RowSpan="2">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform X="5" Y="5"/>
<RotateTransform Angle="45"/>
</TransformGroup>
</Border.RenderTransform>
</Border>
<Border x:Name="PART_Content" Height="0" Grid.Row="1" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter Margin="{TemplateBinding Padding}"/>
</Border>
<Rectangle SnapsToDevicePixels="True" Visibility="{Binding Visibility,ElementName=PART_Triangle}" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left" Width="28" Margin="{Binding Margin,ElementName=PART_Triangle}" Height="1" Fill="{TemplateBinding Background}">
<Rectangle.RenderTransform>
<TransformGroup>
<TranslateTransform X="1"/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CoverViewBaseStyle" TargetType="controls:CoverView">
<!--<Setter Property="item"/>-->
<Setter Property="ItemContainerStyle" Value="{StaticResource CoverViewItemBaseStyle}"/>
<Setter Property="CoverViewContentStyle" Value="{StaticResource CoverViewContentBaseStyle}"/>
<Setter Property="ItemMargin" Value="8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:CoverView">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<ScrollViewer>
<WrapPanel x:Name="PART_Panel"/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -60,10 +60,6 @@
</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"/>
@@ -72,13 +68,12 @@
<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/>
<StackPanel Background="Transparent" Orientation="Horizontal">
<UniformGrid Rows="1" Margin="-5,0" x:Name="PART_Panel"/>
<TextBlock Visibility="{TemplateBinding ShowText,Converter={StaticResource Boolean2VisibilityConverter}}" Text="{TemplateBinding Text}" Margin="10,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
</ControlTemplate>
+4 -4
View File
@@ -32,7 +32,8 @@
<Border.Background>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="Transparent"/>
<GradientStop Color="#80ffffff" Offset=".5"/>
<GradientStop Color="#00ffffff"/>
</LinearGradientBrush>
</Border.Background>
</Border>
@@ -40,9 +41,8 @@
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="1"/>
<GradientStop Color="#aa000000" Offset=".6"/>
<GradientStop Color="#22000000" Offset=".2"/>
<GradientStop Color="Transparent"/>
<GradientStop Color="#80000000" Offset=".5"/>
<GradientStop Color="#00000000"/>
</LinearGradientBrush>
</Border.Background>
</Border>
+8 -2
View File
@@ -1,4 +1,10 @@
<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="Base/CoverViewBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource CoverViewBaseStyle}" TargetType="controls:CoverView"/>
</ResourceDictionary>
@@ -0,0 +1,17 @@
<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">
<Style TargetType="controls:SimpleItemsControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:SimpleItemsControl">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel x:Name="PART_Panel" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>