Files
HandyControl/Net35/HandyControl_Net35/Themes/Styles/Base/CoverViewBaseStyle.xaml
T
2019-01-21 00:43:10 +08:00

74 lines
4.5 KiB
XML

<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 x:Key="CoverViewItemBaseStyle" TargetType="controls:CoverViewItem">
<Setter Property="Margin" Value="{Binding ItemMargin,RelativeSource={RelativeSource AncestorType=controls:CoverView}}"/>
<Setter Property="Width" Value="{Binding ItemWidth,RelativeSource={RelativeSource AncestorType=controls:CoverView}}"/>
<Setter Property="Height" Value="{Binding ItemHeight,RelativeSource={RelativeSource 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 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="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>