CoverViewBaseStyle.xaml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style x:Key="CoverViewItemBaseStyle" TargetType="hc:CoverViewItem">
  5. <Setter Property="Focusable" Value="False"/>
  6. <Setter Property="Template">
  7. <Setter.Value>
  8. <ControlTemplate TargetType="hc:CoverViewItem">
  9. <Border BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
  10. <ContentPresenter ContentSource="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" Margin="{TemplateBinding Padding}"/>
  11. </Border>
  12. </ControlTemplate>
  13. </Setter.Value>
  14. </Setter>
  15. </Style>
  16. <Style x:Key="CoverViewContentBaseStyle" TargetType="hc:CoverViewContent">
  17. <Setter Property="Focusable" Value="False"/>
  18. <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
  19. <Setter Property="BorderThickness" Value="1"/>
  20. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  21. <Setter Property="Margin" Value="0,0,0,8"/>
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="hc:CoverViewContent">
  25. <Grid>
  26. <Grid.RowDefinitions>
  27. <RowDefinition Height="16"/>
  28. <RowDefinition/>
  29. </Grid.RowDefinitions>
  30. <Border x:Name="PART_Triangle" Visibility="Visible" Grid.Row="0" Width="30" Height="30" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.RowSpan="2">
  31. <Border.RenderTransform>
  32. <TransformGroup>
  33. <TranslateTransform X="5" Y="5"/>
  34. <RotateTransform Angle="45"/>
  35. </TransformGroup>
  36. </Border.RenderTransform>
  37. </Border>
  38. <Border x:Name="PART_Content" MinHeight="30" Height="0" Grid.Row="1" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
  39. <ContentPresenter Margin="{TemplateBinding Padding}"/>
  40. </Border>
  41. <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}">
  42. <Rectangle.RenderTransform>
  43. <TransformGroup>
  44. <TranslateTransform X="1"/>
  45. </TransformGroup>
  46. </Rectangle.RenderTransform>
  47. </Rectangle>
  48. </Grid>
  49. </ControlTemplate>
  50. </Setter.Value>
  51. </Setter>
  52. </Style>
  53. <Style x:Key="CoverViewBaseStyle" TargetType="hc:CoverView">
  54. <Setter Property="Focusable" Value="False"/>
  55. <Setter Property="ItemContainerStyle" Value="{StaticResource CoverViewItemBaseStyle}"/>
  56. <Setter Property="CoverViewContentStyle" Value="{StaticResource CoverViewContentBaseStyle}"/>
  57. <Setter Property="ItemMargin" Value="8"/>
  58. <Setter Property="Template">
  59. <Setter.Value>
  60. <ControlTemplate TargetType="hc:CoverView">
  61. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  62. <WrapPanel x:Name="PART_Panel"/>
  63. </Border>
  64. </ControlTemplate>
  65. </Setter.Value>
  66. </Setter>
  67. </Style>
  68. </ResourceDictionary>