AccountExpanderStyle.xaml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
  3. <Setter Property="Foreground" Value="{DynamicResource AcountGridHeadForeground}" />
  4. <Setter Property="Background" Value="{DynamicResource ExpanderHeadBrush}" />
  5. <Setter Property="FontWeight" Value="Light" />
  6. <Setter Property="Template">
  7. <Setter.Value>
  8. <ControlTemplate TargetType="{x:Type ToggleButton}">
  9. <Border Background="{TemplateBinding Background}">
  10. <Grid Margin="{TemplateBinding Padding}" SnapsToDevicePixels="False">
  11. <Grid.ColumnDefinitions>
  12. <ColumnDefinition Width="19" />
  13. <ColumnDefinition Width="*" />
  14. </Grid.ColumnDefinitions>
  15. <Border Width="19"
  16. Height="19"
  17. SnapsToDevicePixels="true">
  18. <Path x:Name="arrow"
  19. HorizontalAlignment="Center"
  20. VerticalAlignment="Center"
  21. Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z"
  22. SnapsToDevicePixels="false"
  23. Stroke="{TemplateBinding Foreground}"
  24. StrokeThickness="1" />
  25. </Border>
  26. <ContentPresenter Grid.Column="1"
  27. Margin="4,0,0,0"
  28. HorizontalAlignment="Left"
  29. VerticalAlignment="Center"
  30. RecognizesAccessKey="True"
  31. SnapsToDevicePixels="True" />
  32. </Grid>
  33. </Border>
  34. <ControlTemplate.Triggers>
  35. <Trigger Property="IsChecked" Value="true">
  36. <Setter TargetName="arrow" Property="Data" Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
  37. </Trigger>
  38. <Trigger Property="IsMouseOver" Value="true" />
  39. <Trigger Property="IsPressed" Value="true" />
  40. </ControlTemplate.Triggers>
  41. </ControlTemplate>
  42. </Setter.Value>
  43. </Setter>
  44. </Style>
  45. <Style x:Key="AccountExpanderStyle" TargetType="{x:Type Expander}">
  46. <Setter Property="Foreground" Value="{DynamicResource AccountExpanderStyleHeadForeground}" />
  47. <Setter Property="Background" Value="Transparent" />
  48. <Setter Property="HorizontalAlignment" Value="Stretch" />
  49. <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
  50. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  51. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  52. <Setter Property="BorderBrush" Value="Transparent" />
  53. <Setter Property="Margin" Value="0,1,0,0" />
  54. <Setter Property="Padding" Value="0,2,0,0" />
  55. <Setter Property="BorderThickness" Value="1" />
  56. <Setter Property="Template">
  57. <Setter.Value>
  58. <ControlTemplate TargetType="{x:Type Expander}">
  59. <Border Background="{TemplateBinding Background}"
  60. BorderBrush="{TemplateBinding BorderBrush}"
  61. BorderThickness="{TemplateBinding BorderThickness}"
  62. CornerRadius="3"
  63. SnapsToDevicePixels="true">
  64. <Grid>
  65. <Grid.RowDefinitions>
  66. <RowDefinition Height="Auto" />
  67. <RowDefinition />
  68. </Grid.RowDefinitions>
  69. <ToggleButton x:Name="HeaderSite"
  70. Grid.Row="0"
  71. MinWidth="0"
  72. MinHeight="0"
  73. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  74. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  75. Content="{TemplateBinding Header}"
  76. ContentTemplate="{TemplateBinding HeaderTemplate}"
  77. ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
  78. FontFamily="{TemplateBinding FontFamily}"
  79. FontSize="{TemplateBinding FontSize}"
  80. FontStretch="{TemplateBinding FontStretch}"
  81. FontStyle="{TemplateBinding FontStyle}"
  82. FontWeight="{TemplateBinding FontWeight}"
  83. Foreground="{TemplateBinding Foreground}"
  84. IsChecked="{Binding IsExpanded,
  85. Mode=TwoWay,
  86. RelativeSource={RelativeSource TemplatedParent}}"
  87. Padding="{TemplateBinding Padding}"
  88. Style="{StaticResource ExpanderDownHeaderStyle}" />
  89. <ContentPresenter x:Name="ExpandSite"
  90. Grid.Row="1"
  91. Margin="0,1"
  92. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  93. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  94. Focusable="false"
  95. Visibility="Collapsed" />
  96. </Grid>
  97. </Border>
  98. <ControlTemplate.Triggers>
  99. <Trigger Property="IsExpanded" Value="true">
  100. <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
  101. </Trigger>
  102. <Trigger Property="IsEnabled" Value="false">
  103. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  104. </Trigger>
  105. </ControlTemplate.Triggers>
  106. </ControlTemplate>
  107. </Setter.Value>
  108. </Setter>
  109. </Style>
  110. </ResourceDictionary>