Simple Styles.xaml 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/interactivedesigner/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
  2. <!-- SimpleStyles.XAML defines a set of control styles which are simplified starting points for creating your own controls -->
  3. <!-- Brushes : These are used to define the color for background, foreground, selection, enabled etc of all controls
  4. If you want to change the color of a control you can just chnage the brush; if you want to add a new shape or change arrangement then also edit the template -->
  5. <!-- NormalBrush is used as the Background for SimpleButton, SimpleRepeatButton -->
  6. <LinearGradientBrush x:Key="NormalBrush" EndPoint="0,1" StartPoint="0,0">
  7. <GradientStop Color="#EEE" Offset="0.0"/>
  8. <GradientStop Color="#CCC" Offset="1.0"/>
  9. </LinearGradientBrush>
  10. <LinearGradientBrush x:Key="NormalBorderBrush" EndPoint="0,1" StartPoint="0,0">
  11. <GradientStop Color="#CCC" Offset="0.0"/>
  12. <GradientStop Color="#444" Offset="1.0"/>
  13. </LinearGradientBrush>
  14. <!-- LightBrush is used for content areas such as Menu, Tab Control background -->
  15. <LinearGradientBrush x:Key="LightBrush" EndPoint="0,1" StartPoint="0,0">
  16. <GradientStop Color="#FFF" Offset="0.0"/>
  17. <GradientStop Color="#EEE" Offset="1.0"/>
  18. </LinearGradientBrush>
  19. <!-- MouseOverBrush is used for MouseOver in Button, Radio Button, CheckBox -->
  20. <LinearGradientBrush x:Key="MouseOverBrush" EndPoint="0,1" StartPoint="0,0">
  21. <GradientStop Color="#FFF" Offset="0.0"/>
  22. <GradientStop Color="#AAA" Offset="1.0"/>
  23. </LinearGradientBrush>
  24. <!-- PressedBrush is used for Pressed in Button, Radio Button, CheckBox -->
  25. <LinearGradientBrush x:Key="PressedBrush" EndPoint="0,1" StartPoint="0,0">
  26. <GradientStop Color="#BBB" Offset="0.0"/>
  27. <GradientStop Color="#EEE" Offset="0.1"/>
  28. <GradientStop Color="#EEE" Offset="0.9"/>
  29. <GradientStop Color="#FFF" Offset="1.0"/>
  30. </LinearGradientBrush>
  31. <LinearGradientBrush x:Key="PressedBorderBrush" EndPoint="0,1" StartPoint="0,0">
  32. <GradientStop Color="#444" Offset="0.0"/>
  33. <GradientStop Color="#888" Offset="1.0"/>
  34. </LinearGradientBrush>
  35. <!-- SelectedBackgroundBrush is used for the Selected item in ListBoxItem, ComboBoxItem-->
  36. <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#DDD"/>
  37. <!-- Disabled Brushes are used for the Disabled look of each control -->
  38. <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888"/>
  39. <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE"/>
  40. <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA"/>
  41. <!-- Used for background of ScrollViewer, TreeView, ListBox, Expander, TextBox, Tab Control -->
  42. <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FFF"/>
  43. <!-- DefaultedBorderBrush is used to show KeyBoardFocus -->
  44. <LinearGradientBrush x:Key="DefaultedBorderBrush" EndPoint="0,1" StartPoint="0,0">
  45. <GradientStop Color="#777" Offset="0.0"/>
  46. <GradientStop Color="#000" Offset="1.0"/>
  47. </LinearGradientBrush>
  48. <SolidColorBrush x:Key="SolidBorderBrush" Color="#888"/>
  49. <SolidColorBrush x:Key="LightBorderBrush" Color="#AAA"/>
  50. <SolidColorBrush x:Key="LightColorBrush" Color="#DDD"/>
  51. <!-- Used for Checkmark, Radio button, TreeViewItem, Expander ToggleButton glyphs -->
  52. <SolidColorBrush x:Key="GlyphBrush" Color="#444"/>
  53. <!-- Style and Template pairs are used to define each control Part -->
  54. <!-- The Style provides default values on the control; the Template gives the elements for each control -->
  55. <!-- SimpleButtonFocusVisual is used to show keyboard focus around a SimpleButton control -->
  56. <Style x:Key="SimpleButtonFocusVisual">
  57. <Setter Property="Control.Template">
  58. <Setter.Value>
  59. <ControlTemplate>
  60. <Border>
  61. <Rectangle Margin="2" Stroke="#60000000" StrokeThickness="1" StrokeDashArray="1 2"/>
  62. </Border>
  63. </ControlTemplate>
  64. </Setter.Value>
  65. </Setter>
  66. </Style>
  67. <!-- Simple Button - This control sets brushes on each state. Note that these brushes must be listed above since they are static resources -->
  68. <Style x:Key="SimpleButton" TargetType="{x:Type Button}" BasedOn="{x:Null}">
  69. <Setter Property="FocusVisualStyle" Value="{DynamicResource SimpleButtonFocusVisual}"/>
  70. <Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
  71. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  72. <Setter Property="Template">
  73. <Setter.Value>
  74. <ControlTemplate TargetType="{x:Type Button}">
  75. <!-- We use Grid as a root because it is easy to add more elements to customize the button -->
  76. <Grid x:Name="Grid">
  77. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/>
  78. <!-- Content Presenter is where the text content etc is placed by the control -->
  79. <!-- The bindings are useful so that the control can be parameterized without editing the template -->
  80. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
  81. </Grid>
  82. <!--Each state sets a brush on the Border in the template -->
  83. <ControlTemplate.Triggers>
  84. <Trigger Property="IsKeyboardFocused" Value="true">
  85. <Setter Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" TargetName="Border"/>
  86. </Trigger>
  87. <Trigger Property="IsMouseOver" Value="true">
  88. <Setter Property="Background" Value="{DynamicResource MouseOverBrush}" TargetName="Border"/>
  89. </Trigger>
  90. <Trigger Property="IsPressed" Value="true">
  91. <Setter Property="Background" Value="{DynamicResource PressedBrush}" TargetName="Border"/>
  92. <Setter Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" TargetName="Border"/>
  93. </Trigger>
  94. <Trigger Property="IsEnabled" Value="true"/>
  95. <Trigger Property="IsEnabled" Value="false">
  96. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  97. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  98. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  99. </Trigger>
  100. </ControlTemplate.Triggers>
  101. </ControlTemplate>
  102. </Setter.Value>
  103. </Setter>
  104. </Style>
  105. <Style x:Key="RadioButtonFocusVisual">
  106. <Setter Property="Control.Template">
  107. <Setter.Value>
  108. <ControlTemplate>
  109. <Border>
  110. <Rectangle Margin="15,0,0,0" Stroke="#60000000" StrokeThickness="1" StrokeDashArray="1 2"/>
  111. </Border>
  112. </ControlTemplate>
  113. </Setter.Value>
  114. </Setter>
  115. </Style>
  116. <Style x:Key="CheckBoxFocusVisual">
  117. <Setter Property="Control.Template">
  118. <Setter.Value>
  119. <ControlTemplate>
  120. <Border>
  121. <Rectangle Margin="15,0,0,0" Stroke="#60000000" StrokeThickness="1" StrokeDashArray="1 2"/>
  122. </Border>
  123. </ControlTemplate>
  124. </Setter.Value>
  125. </Setter>
  126. </Style>
  127. <!-- Simple CheckBox -->
  128. <Style x:Key="SimpleCheckBox" TargetType="{x:Type CheckBox}">
  129. <Setter Property="SnapsToDevicePixels" Value="true"/>
  130. <Setter Property="FocusVisualStyle" Value="{DynamicResource CheckBoxFocusVisual}"/>
  131. <Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
  132. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  133. <Setter Property="Template">
  134. <Setter.Value>
  135. <ControlTemplate TargetType="{x:Type CheckBox}">
  136. <!-- BulletDecorator is used to provide baseline alignment between the checkmark and the Content -->
  137. <BulletDecorator Background="Transparent">
  138. <BulletDecorator.Bullet>
  139. <Grid Width="13" Height="13">
  140. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
  141. <Path x:Name="CheckMark" Stroke="{DynamicResource GlyphBrush}" StrokeThickness="2" SnapsToDevicePixels="False" Data="M 0 0 L 13 13 M 0 13 L 13 0"/>
  142. </Grid>
  143. </BulletDecorator.Bullet>
  144. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
  145. </BulletDecorator>
  146. <!-- This uses Visibility to hide and show the CheckMark on IsChecked -->
  147. <ControlTemplate.Triggers>
  148. <Trigger Property="IsChecked" Value="false">
  149. <Setter Property="Visibility" Value="Collapsed" TargetName="CheckMark"/>
  150. </Trigger>
  151. <Trigger Property="IsMouseOver" Value="true">
  152. <Setter Property="Background" Value="{DynamicResource MouseOverBrush}" TargetName="Border"/>
  153. </Trigger>
  154. <Trigger Property="IsPressed" Value="true">
  155. <Setter Property="Background" Value="{DynamicResource PressedBrush}" TargetName="Border"/>
  156. <Setter Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" TargetName="Border"/>
  157. </Trigger>
  158. <Trigger Property="IsEnabled" Value="false">
  159. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  160. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  161. </Trigger>
  162. </ControlTemplate.Triggers>
  163. </ControlTemplate>
  164. </Setter.Value>
  165. </Setter>
  166. </Style>
  167. <!-- Simple Radio Button -->
  168. <Style x:Key="SimpleRadioButton" TargetType="{x:Type RadioButton}">
  169. <Setter Property="SnapsToDevicePixels" Value="true"/>
  170. <Setter Property="FocusVisualStyle" Value="{DynamicResource RadioButtonFocusVisual}"/>
  171. <Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
  172. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  173. <Setter Property="Template">
  174. <Setter.Value>
  175. <ControlTemplate TargetType="{x:Type RadioButton}">
  176. <!-- BulletDecorator is used to provide baseline alignment between the checkmark and the Content -->
  177. <BulletDecorator Background="Transparent">
  178. <BulletDecorator.Bullet>
  179. <Grid Width="13" Height="13">
  180. <Ellipse x:Name="Ellipse_Border" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
  181. <Ellipse Margin="4" x:Name="CheckMark" Fill="{DynamicResource GlyphBrush}"/>
  182. </Grid>
  183. </BulletDecorator.Bullet>
  184. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
  185. </BulletDecorator>
  186. <ControlTemplate.Triggers>
  187. <Trigger Property="IsChecked" Value="false">
  188. <Setter Property="Visibility" Value="Collapsed" TargetName="CheckMark"/>
  189. </Trigger>
  190. <Trigger Property="IsMouseOver" Value="true">
  191. <Setter Property="Fill" Value="{DynamicResource MouseOverBrush}" TargetName="Ellipse_Border"/>
  192. </Trigger>
  193. <Trigger Property="IsPressed" Value="true">
  194. <Setter Property="Fill" Value="{DynamicResource PressedBrush}" TargetName="Ellipse_Border"/>
  195. <Setter Property="Stroke" Value="{DynamicResource GlyphBrush}" TargetName="Ellipse_Border"/>
  196. </Trigger>
  197. <Trigger Property="IsEnabled" Value="false">
  198. <Setter Property="Fill" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Ellipse_Border"/>
  199. <Setter Property="Stroke" Value="#40000000" TargetName="Ellipse_Border"/>
  200. <Setter Property="Foreground" Value="#80000000"/>
  201. </Trigger>
  202. </ControlTemplate.Triggers>
  203. </ControlTemplate>
  204. </Setter.Value>
  205. </Setter>
  206. </Style>
  207. <!-- Simple Repeat Button - This is used by Simple ScrollBar for the up and down buttons -->
  208. <Style x:Key="SimpleRepeatButton" d:IsControlPart="True" TargetType="{x:Type RepeatButton}" BasedOn="{x:Null}">
  209. <Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
  210. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  211. <Setter Property="Template">
  212. <Setter.Value>
  213. <ControlTemplate TargetType="{x:Type RepeatButton}">
  214. <Grid>
  215. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
  216. <ContentPresenter HorizontalAlignment="Center" x:Name="ContentPresenter" VerticalAlignment="Center" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"/>
  217. </Grid>
  218. <ControlTemplate.Triggers>
  219. <Trigger Property="IsKeyboardFocused" Value="true">
  220. <Setter Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" TargetName="Border"/>
  221. </Trigger>
  222. <Trigger Property="IsMouseOver" Value="true">
  223. <Setter Property="Background" Value="{DynamicResource MouseOverBrush}" TargetName="Border"/>
  224. </Trigger>
  225. <Trigger Property="IsPressed" Value="true">
  226. <Setter Property="Background" Value="{DynamicResource PressedBrush}" TargetName="Border"/>
  227. <Setter Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" TargetName="Border"/>
  228. </Trigger>
  229. <Trigger Property="IsEnabled" Value="false">
  230. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  231. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  232. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  233. </Trigger>
  234. </ControlTemplate.Triggers>
  235. </ControlTemplate>
  236. </Setter.Value>
  237. </Setter>
  238. </Style>
  239. <!-- Simple Thumb - The Thumb is the draggable part of the Scrollbar -->
  240. <Style x:Key="SimpleThumbStyle" d:IsControlPart="True" TargetType="{x:Type Thumb}" BasedOn="{x:Null}">
  241. <Setter Property="Template">
  242. <Setter.Value>
  243. <ControlTemplate TargetType="{x:Type Thumb}">
  244. <Grid Margin="0,0,0,0" x:Name="Grid">
  245. <Rectangle HorizontalAlignment="Stretch" x:Name="Rectangle" VerticalAlignment="Stretch" Width="Auto" Height="Auto" RadiusX="2" RadiusY="2" Fill="{DynamicResource NormalBrush}" Stroke="{DynamicResource NormalBorderBrush}"/>
  246. </Grid>
  247. <ControlTemplate.Triggers>
  248. <Trigger Property="IsFocused" Value="True"/>
  249. <Trigger Property="IsMouseOver" Value="True"/>
  250. <Trigger Property="IsEnabled" Value="False"/>
  251. <Trigger Property="IsDragging" Value="True"/>
  252. </ControlTemplate.Triggers>
  253. </ControlTemplate>
  254. </Setter.Value>
  255. </Setter>
  256. </Style>
  257. <!-- Simple ScrollRepeatButton Style - This RepeatButton is used above and below the Thumb in the Scrollbar. They are set to transparent si that they do not show over the scrollbar -->
  258. <Style x:Key="SimpleScrollRepeatButtonStyle" d:IsControlPart="True" TargetType="{x:Type RepeatButton}">
  259. <Setter Property="Background" Value="Transparent"/>
  260. <Setter Property="BorderBrush" Value="Transparent"/>
  261. <Setter Property="IsTabStop" Value="false"/>
  262. <Setter Property="Focusable" Value="false"/>
  263. <Setter Property="Template">
  264. <Setter.Value>
  265. <ControlTemplate TargetType="{x:Type RepeatButton}">
  266. <Grid>
  267. <Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"/>
  268. </Grid>
  269. </ControlTemplate>
  270. </Setter.Value>
  271. </Setter>
  272. </Style>
  273. <!-- Simple ScrollBar This makes use of SimpleThumb, SimpleRepeatButton and SimpleScrollRepeatButton -->
  274. <Style x:Key="SimpleScrollBar" TargetType="{x:Type ScrollBar}">
  275. <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
  276. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  277. <Setter Property="Template">
  278. <Setter.Value>
  279. <ControlTemplate TargetType="{x:Type ScrollBar}">
  280. <Grid x:Name="GridRoot" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Background="{TemplateBinding Background}">
  281. <Grid.RowDefinitions>
  282. <RowDefinition MaxHeight="18"/>
  283. <RowDefinition Height="0.00001*"/>
  284. <RowDefinition MaxHeight="18"/>
  285. </Grid.RowDefinitions>
  286. <RepeatButton x:Name="DecreaseRepeat" Style="{DynamicResource SimpleRepeatButton}" Command="ScrollBar.LineUpCommand">
  287. <Grid>
  288. <Path x:Name="DecreaseArrow" Stroke="{TemplateBinding Foreground}" StrokeThickness="1" Data="M 0 4 L 8 4 L 4 0 Z"/>
  289. </Grid>
  290. </RepeatButton>
  291. <!-- Track is a special layout container which sizes the thumb and the repeat button which do jump scrolling either side of it -->
  292. <Track Grid.Row="1" x:Name="PART_Track" Orientation="Vertical" IsDirectionReversed="true">
  293. <Track.Thumb>
  294. <Thumb Style="{DynamicResource SimpleThumbStyle}"/>
  295. </Track.Thumb>
  296. <Track.IncreaseRepeatButton>
  297. <RepeatButton x:Name="PageUp" Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="ScrollBar.PageDownCommand"/>
  298. </Track.IncreaseRepeatButton>
  299. <Track.DecreaseRepeatButton>
  300. <RepeatButton x:Name="PageDown" Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="ScrollBar.PageUpCommand"/>
  301. </Track.DecreaseRepeatButton>
  302. </Track>
  303. <RepeatButton Grid.Row="2" x:Name="IncreaseRepeat" Style="{DynamicResource SimpleRepeatButton}" Command="ScrollBar.LineDownCommand">
  304. <Grid>
  305. <Path x:Name="IncreaseArrow" Stroke="{TemplateBinding Foreground}" StrokeThickness="1" Data="M 0 0 L 4 4 L 8 0 Z"/>
  306. </Grid>
  307. </RepeatButton>
  308. </Grid>
  309. <!-- This uses a single template for ScrollBar and rotate it to be Horizontal
  310. It also changes the commands so that the it does Left and Right instead of Up and Down Commands -->
  311. <ControlTemplate.Triggers>
  312. <Trigger Property="Orientation" Value="Horizontal">
  313. <!-- Rotate the ScrollBar from Vertical to Horizontal -->
  314. <Setter Property="LayoutTransform" TargetName="GridRoot">
  315. <Setter.Value>
  316. <RotateTransform Angle="-90"/>
  317. </Setter.Value>
  318. </Setter>
  319. <!-- Track is bound to Orientation internally, so we need to rotate it back to Vertical -->
  320. <Setter TargetName="PART_Track" Property="Orientation" Value="Vertical"/>
  321. <!-- Change the commands to do Horizontal commands -->
  322. <Setter Property="Command" Value="ScrollBar.LineLeftCommand" TargetName="DecreaseRepeat"/>
  323. <Setter Property="Command" Value="ScrollBar.LineRightCommand" TargetName="IncreaseRepeat"/>
  324. <Setter Property="Command" Value="ScrollBar.PageLeftCommand" TargetName="PageDown"/>
  325. <Setter Property="Command" Value="ScrollBar.PageRightCommand" TargetName="PageUp"/>
  326. </Trigger>
  327. </ControlTemplate.Triggers>
  328. </ControlTemplate>
  329. </Setter.Value>
  330. </Setter>
  331. </Style>
  332. <!-- Simple ScrollViewer
  333. ScrollViewer is a Grid control which has a ContentPresenter and a Horizontal and Vertical ScrollBar
  334. It is used by ListBox, MenuItem, ComboBox, and TreeView -->
  335. <Style x:Key="SimpleScrollViewer" TargetType="{x:Type ScrollViewer}" BasedOn="{x:Null}">
  336. <Setter Property="Template">
  337. <Setter.Value>
  338. <ControlTemplate TargetType="{x:Type ScrollViewer}">
  339. <Grid Background="{TemplateBinding Background}">
  340. <Grid.ColumnDefinitions>
  341. <ColumnDefinition Width="*"/>
  342. <ColumnDefinition Width="Auto"/>
  343. </Grid.ColumnDefinitions>
  344. <Grid.RowDefinitions>
  345. <RowDefinition Height="*"/>
  346. <RowDefinition Height="Auto"/>
  347. </Grid.RowDefinitions>
  348. <ScrollContentPresenter Grid.Column="0" Grid.Row="0" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}"/>
  349. <!-- The visibility of the ScrollBars is controlled by the implementation fo the control -->
  350. <ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Grid.Column="0" Grid.Row="1" x:Name="PART_HorizontalScrollBar" Style="{DynamicResource SimpleScrollBar}" Orientation="Horizontal" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" />
  351. <ScrollBar Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Grid.Column="1" Grid.Row="0" x:Name="PART_VerticalScrollBar" Style="{DynamicResource SimpleScrollBar}" Orientation="Vertical" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Minimum="0" Maximum="{TemplateBinding ScrollableHeight}" />
  352. </Grid>
  353. </ControlTemplate>
  354. </Setter.Value>
  355. </Setter>
  356. </Style>
  357. <!-- Simple ListBox - This uses SimpleScrollViewer to allow items to be scrolled and SimpleListBoxItem to define the look of each item -->
  358. <Style x:Key="SimpleListBox" TargetType="{x:Type ListBox}">
  359. <Setter Property="SnapsToDevicePixels" Value="true"/>
  360. <Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}"/>
  361. <Setter Property="BorderBrush" Value="{DynamicResource SolidBorderBrush}"/>
  362. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  363. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  364. <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
  365. <Setter Property="Template">
  366. <Setter.Value>
  367. <ControlTemplate TargetType="{x:Type ListBox}">
  368. <Grid>
  369. <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
  370. <ScrollViewer Margin="1" Style="{DynamicResource SimpleScrollViewer}" Focusable="false" Background="{TemplateBinding Background}">
  371. <!-- The StackPanel is used to display the children by setting IsItemsHost to be Trus -->
  372. <StackPanel Margin="2" IsItemsHost="true"/>
  373. </ScrollViewer>
  374. </Grid>
  375. <ControlTemplate.Triggers>
  376. <Trigger Property="IsEnabled" Value="false">
  377. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  378. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  379. </Trigger>
  380. <Trigger Property="IsGrouping" Value="true">
  381. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  382. </Trigger>
  383. </ControlTemplate.Triggers>
  384. </ControlTemplate>
  385. </Setter.Value>
  386. </Setter>
  387. </Style>
  388. <!-- Simple ListBoxItem - This is used for each Item in a ListBox. The item's content is placed in the ContentPresenter -->
  389. <Style x:Key="SimpleListBoxItem" d:IsControlPart="True" TargetType="{x:Type ListBoxItem}">
  390. <Setter Property="SnapsToDevicePixels" Value="true"/>
  391. <Setter Property="OverridesDefaultStyle" Value="true"/>
  392. <Setter Property="Template">
  393. <Setter.Value>
  394. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  395. <Grid SnapsToDevicePixels="true">
  396. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
  397. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  398. </Grid>
  399. <ControlTemplate.Triggers>
  400. <!-- Change IsSelected SelectedBackgroundBrush to set the selection color for the items -->
  401. <Trigger Property="IsSelected" Value="true">
  402. <Setter Property="Background" Value="{DynamicResource SelectedBackgroundBrush}" TargetName="Border"/>
  403. </Trigger>
  404. <Trigger Property="IsEnabled" Value="false">
  405. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  406. </Trigger>
  407. </ControlTemplate.Triggers>
  408. </ControlTemplate>
  409. </Setter.Value>
  410. </Setter>
  411. </Style>
  412. <!-- Simple Expander ToggleButton - This Button is used by the Expander control. When it is toggled it switches visibility on the Up_Arrow and Down_Arrow -->
  413. <ControlTemplate x:Key="ExpanderToggleButton" TargetType="{x:Type ToggleButton}">
  414. <Grid>
  415. <Rectangle Margin="0,0,0,0" x:Name="Rectangle" Fill="Transparent" Stroke="{DynamicResource NormalBorderBrush}"/>
  416. <Path HorizontalAlignment="Center" x:Name="Up_Arrow" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 0 0 L 4 4 L 8 0 Z"/>
  417. <Path Visibility="Collapsed" HorizontalAlignment="Center" x:Name="Down_Arrow" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 0 4 L 4 0 L 8 4 Z"/>
  418. </Grid>
  419. <ControlTemplate.Triggers>
  420. <Trigger Property="IsMouseOver" Value="true">
  421. <Setter Property="Fill" Value="{DynamicResource MouseOverBrush}" TargetName="Rectangle"/>
  422. </Trigger>
  423. <Trigger Property="IsPressed" Value="true">
  424. <Setter Property="Fill" Value="{DynamicResource PressedBrush}" TargetName="Rectangle"/>
  425. </Trigger>
  426. <Trigger Property="IsChecked" Value="true">
  427. <Setter Property="Visibility" Value="Visible" TargetName="Down_Arrow"/>
  428. <Setter Property="Visibility" Value="Collapsed" TargetName="Up_Arrow"/>
  429. </Trigger>
  430. <Trigger Property="IsEnabled" Value="False">
  431. <Setter Property="Fill" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Rectangle"/>
  432. <Setter Property="Stroke" Value="{DynamicResource DisabledBorderBrush}" TargetName="Rectangle"/>
  433. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  434. <Setter Property="Fill" Value="{DynamicResource DisabledForegroundBrush}" TargetName="Up_Arrow"/>
  435. </Trigger>
  436. </ControlTemplate.Triggers>
  437. </ControlTemplate>
  438. <!-- Simple Expander
  439. This uses the Simpler ExpanderToggleButton. It sets Visibility on the ContentPresenter to expand
  440. Limitations : The Simple Expander only expands down -->
  441. <Style x:Key="SimpleExpander" TargetType="{x:Type Expander}">
  442. <Setter Property="Background" Value="{DynamicResource LightBrush}"/>
  443. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  444. <Setter Property="Template">
  445. <Setter.Value>
  446. <ControlTemplate TargetType="{x:Type Expander}">
  447. <Grid>
  448. <Grid.RowDefinitions>
  449. <RowDefinition Height="Auto"/>
  450. <RowDefinition Height="*" x:Name="ContentRow"/>
  451. </Grid.RowDefinitions>
  452. <Border Grid.Row="0" x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2,2,0,0">
  453. <Grid>
  454. <Grid.ColumnDefinitions>
  455. <ColumnDefinition Width="20"/>
  456. <ColumnDefinition Width="*"/>
  457. </Grid.ColumnDefinitions>
  458. <ToggleButton Template="{DynamicResource ExpanderToggleButton}" Background="{DynamicResource NormalBrush}" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" OverridesDefaultStyle="True"/>
  459. <ContentPresenter Grid.Column="1" Margin="4" RecognizesAccessKey="True" ContentSource="Header"/>
  460. </Grid>
  461. </Border>
  462. <Border Visibility="Collapsed" Grid.Row="1" x:Name="ExpandSite" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1,0,1,1" CornerRadius="0,0,2,2">
  463. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="false"/>
  464. </Border>
  465. </Grid>
  466. <ControlTemplate.Triggers>
  467. <Trigger Property="IsExpanded" Value="True">
  468. <Setter Property="Visibility" Value="Visible" TargetName="ExpandSite"/>
  469. </Trigger>
  470. <Trigger Property="IsEnabled" Value="False">
  471. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  472. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  473. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  474. </Trigger>
  475. </ControlTemplate.Triggers>
  476. </ControlTemplate>
  477. </Setter.Value>
  478. </Setter>
  479. </Style>
  480. <!-- Simple ComboBox Toggle Button - This is used in ComboBox to expand and collapse the ComboBox Popup-->
  481. <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  482. <Grid>
  483. <Grid.ColumnDefinitions>
  484. <ColumnDefinition/>
  485. <ColumnDefinition Width="20"/>
  486. </Grid.ColumnDefinitions>
  487. <Rectangle Grid.ColumnSpan="2" HorizontalAlignment="Stretch" x:Name="Rectangle" VerticalAlignment="Stretch" Width="Auto" Height="Auto" RadiusX="5" RadiusY="5" Fill="{DynamicResource NormalBrush}" Stroke="{DynamicResource NormalBorderBrush}"/>
  488. <Rectangle Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" RadiusX="5" RadiusY="5" Fill="{DynamicResource WindowBackgroundBrush}" Stroke="{DynamicResource NormalBorderBrush}"/>
  489. <Path Grid.Column="1" HorizontalAlignment="Center" x:Name="Arrow" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 0 0 L 4 4 L 8 0 Z"/>
  490. </Grid>
  491. <ControlTemplate.Triggers>
  492. <Trigger Property="IsMouseOver" Value="true">
  493. <Setter Property="Fill" Value="{DynamicResource MouseOverBrush}" TargetName="Rectangle"/>
  494. </Trigger>
  495. <Trigger Property="IsChecked" Value="true">
  496. <Setter Property="Fill" Value="{DynamicResource PressedBrush}" TargetName="Rectangle"/>
  497. </Trigger>
  498. <Trigger Property="IsEnabled" Value="False">
  499. <Setter Property="Fill" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Rectangle"/>
  500. <Setter Property="Stroke" Value="{DynamicResource DisabledBorderBrush}" TargetName="Rectangle"/>
  501. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  502. <Setter Property="Fill" Value="{DynamicResource DisabledForegroundBrush}" TargetName="Arrow"/>
  503. </Trigger>
  504. </ControlTemplate.Triggers>
  505. </ControlTemplate>
  506. <!-- This is the area which contains the selected item in the ComboBox -->
  507. <ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
  508. <!-- This must be named as PART_ContentHost -->
  509. <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}"/>
  510. </ControlTemplate>
  511. <!-- Simple ComboBox
  512. This uses the ComboBoxToggleButton to expand and collapse a Popup control
  513. SimpleScrollViewer to allow items to be scrolled and SimpleComboBoxItem to define the look of each item
  514. The Popup shows a list of items in a StackPanel-->
  515. <Style x:Key="SimpleComboBox" TargetType="{x:Type ComboBox}">
  516. <Setter Property="SnapsToDevicePixels" Value="true"/>
  517. <Setter Property="Template">
  518. <Setter.Value>
  519. <ControlTemplate TargetType="{x:Type ComboBox}">
  520. <Grid>
  521. <!-- The ToggleButton is databound to the ComboBox itself to toggle IsDropDownOpen -->
  522. <ToggleButton Grid.Column="2" Template="{DynamicResource ComboBoxToggleButton}" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
  523. <ContentPresenter HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="ContentSite" VerticalAlignment="Center" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" IsHitTestVisible="False"/>
  524. <!-- The TextBox must be named PART_EditableTextBox or ComboBox will not recognize it -->
  525. <TextBox Visibility="Hidden" Template="{DynamicResource ComboBoxTextBox}" HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="PART_EditableTextBox" Style="{x:Null}" VerticalAlignment="Center" Focusable="True" Background="Transparent" IsReadOnly="{TemplateBinding IsReadOnly}"/>
  526. <!-- The Popup shows the list of items in the ComboBox. IsOpen is databound to IsDropDownOpen which is toggled via the ComboBoxToggleButton -->
  527. <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
  528. <Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
  529. <Border x:Name="DropDownBorder" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/>
  530. <ScrollViewer Margin="4,6,4,6" Style="{DynamicResource SimpleScrollViewer}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
  531. <!-- The StackPanel is used to display the children by setting IsItemsHost to be True -->
  532. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained"/>
  533. </ScrollViewer>
  534. </Grid>
  535. </Popup>
  536. </Grid>
  537. <ControlTemplate.Triggers>
  538. <!-- This forces the DropDown to have a minimum size if it is empty -->
  539. <Trigger Property="HasItems" Value="false">
  540. <Setter Property="MinHeight" Value="95" TargetName="DropDownBorder"/>
  541. </Trigger>
  542. <Trigger Property="IsEnabled" Value="false">
  543. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  544. </Trigger>
  545. <Trigger Property="IsGrouping" Value="true">
  546. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  547. </Trigger>
  548. <Trigger Property="AllowsTransparency" SourceName="Popup" Value="true">
  549. <Setter Property="CornerRadius" Value="4" TargetName="DropDownBorder"/>
  550. <Setter Property="Margin" Value="0,2,0,0" TargetName="DropDownBorder"/>
  551. </Trigger>
  552. <Trigger Property="IsEditable" Value="true">
  553. <Setter Property="IsTabStop" Value="false"/>
  554. <Setter Property="Visibility" Value="Visible" TargetName="PART_EditableTextBox"/>
  555. <Setter Property="Visibility" Value="Hidden" TargetName="ContentSite"/>
  556. </Trigger>
  557. </ControlTemplate.Triggers>
  558. </ControlTemplate>
  559. </Setter.Value>
  560. </Setter>
  561. </Style>
  562. <!-- Simple ComboBoxItem - This is used for each item inside of the ComboBox. You can change the selected color of each item below-->
  563. <Style x:Key="SimpleComboBoxItem" d:IsControlPart="True" TargetType="{x:Type ComboBoxItem}">
  564. <Setter Property="SnapsToDevicePixels" Value="true"/>
  565. <Setter Property="Template">
  566. <Setter.Value>
  567. <ControlTemplate TargetType="{x:Type ComboBoxItem}">
  568. <Grid SnapsToDevicePixels="true">
  569. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
  570. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  571. </Grid>
  572. <ControlTemplate.Triggers>
  573. <!-- Change IsHighlighted SelectedBackgroundBrush to set the selection color for the items -->
  574. <Trigger Property="IsHighlighted" Value="true">
  575. <Setter Property="Background" Value="{DynamicResource SelectedBackgroundBrush}" TargetName="Border"/>
  576. </Trigger>
  577. <Trigger Property="IsEnabled" Value="false">
  578. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  579. </Trigger>
  580. </ControlTemplate.Triggers>
  581. </ControlTemplate>
  582. </Setter.Value>
  583. </Setter>
  584. </Style>
  585. <!-- Simple SimpleProgressBar
  586. The template uses two Border controls to show the Track and Progress
  587. Limitations : It only supports a horizontal orientated ProgressBar -->
  588. <Style x:Key="SimpleProgressBar" TargetType="{x:Type ProgressBar}">
  589. <Setter Property="Template">
  590. <Setter.Value>
  591. <ControlTemplate TargetType="{x:Type ProgressBar}">
  592. <Grid>
  593. <!-- This Border is the track. It must be named PART_Track -->
  594. <Border x:Name="PART_Track" Background="{DynamicResource PressedBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1" CornerRadius="2"/>
  595. <!-- This Border shows progress. It must be named PART_Indicator for the control to function -->
  596. <Border HorizontalAlignment="Left" x:Name="PART_Indicator" Background="{DynamicResource MouseOverBrush}" BorderBrush="{DynamicResource NormalBorderBrush}" BorderThickness="1" CornerRadius="2"/>
  597. </Grid>
  598. </ControlTemplate>
  599. </Setter.Value>
  600. </Setter>
  601. </Style>
  602. <!-- Simple TextBox -->
  603. <Style x:Key="SimpleTextBox" TargetType="{x:Type TextBox}">
  604. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  605. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  606. <Setter Property="AllowDrop" Value="true"/>
  607. <Setter Property="Template">
  608. <Setter.Value>
  609. <ControlTemplate TargetType="{x:Type TextBox}">
  610. <Grid>
  611. <Border x:Name="Border" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1" Padding="2" CornerRadius="2">
  612. <!-- The implementation places the Content into the ScrollViewer. It must be named PART_ContentHost for the control to function -->
  613. <ScrollViewer Margin="0" x:Name="PART_ContentHost" Style="{DynamicResource SimpleScrollViewer}" Background="{TemplateBinding Background}"/>
  614. </Border>
  615. </Grid>
  616. <ControlTemplate.Triggers>
  617. <Trigger Property="IsEnabled" Value="False">
  618. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  619. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  620. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  621. </Trigger>
  622. </ControlTemplate.Triggers>
  623. </ControlTemplate>
  624. </Setter.Value>
  625. </Setter>
  626. </Style>
  627. <!-- Simple Label - This template is just a ContentPresenter that shows the content of the Label -->
  628. <Style x:Key="SimpleLabel" TargetType="{x:Type Label}">
  629. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  630. <Setter Property="VerticalContentAlignment" Value="Top"/>
  631. <Setter Property="Template">
  632. <Setter.Value>
  633. <ControlTemplate TargetType="{x:Type Label}">
  634. <Grid>
  635. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
  636. </Grid>
  637. <ControlTemplate.Triggers>
  638. <Trigger Property="IsEnabled" Value="false"/>
  639. </ControlTemplate.Triggers>
  640. </ControlTemplate>
  641. </Setter.Value>
  642. </Setter>
  643. </Style>
  644. <!-- Simple Menu - This template uses a StackPanel to layout MenuItems -->
  645. <Style x:Key="SimpleMenu" TargetType="{x:Type Menu}">
  646. <Setter Property="Background" Value="{DynamicResource LightBrush}"/>
  647. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  648. <Setter Property="SnapsToDevicePixels" Value="True"/>
  649. <Setter Property="Template">
  650. <Setter.Value>
  651. <ControlTemplate TargetType="{x:Type Menu}">
  652. <Grid>
  653. <Border Margin="1" x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/>
  654. <StackPanel Background="{TemplateBinding Background}" IsItemsHost="True" ClipToBounds="True" Orientation="Horizontal"/>
  655. </Grid>
  656. <ControlTemplate.Triggers>
  657. <Trigger Property="IsEnabled" Value="False">
  658. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  659. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  660. </Trigger>
  661. </ControlTemplate.Triggers>
  662. </ControlTemplate>
  663. </Setter.Value>
  664. </Setter>
  665. </Style>
  666. <!-- This BitmapEffect is used by the Simple MenuItem -->
  667. <DropShadowBitmapEffect x:Key="PopupDropShadow" ShadowDepth="1.5" Softness="0.15"/>
  668. <!-- Simple MenuItem - The template uses triggers to provide four different arrangements of menu item which are set via the Role property -->
  669. <Style x:Key="SimpleMenuItem" TargetType="{x:Type MenuItem}">
  670. <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  671. <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  672. <Setter Property="Background" Value="Transparent"/>
  673. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
  674. <Setter Property="Template">
  675. <Setter.Value>
  676. <ControlTemplate TargetType="{x:Type MenuItem}">
  677. <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
  678. <Grid>
  679. <!-- The Grid is used to hold together columns for an Icon, Content, Glyph checkmark and Arrow to show the next level
  680. Size sharing is used in Grid so that the Icon, Content, Arrow for each MenuItem align together -->
  681. <Grid.ColumnDefinitions>
  682. <ColumnDefinition MinWidth="17" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
  683. <ColumnDefinition Width="*"/>
  684. <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
  685. <ColumnDefinition Width="14"/>
  686. </Grid.ColumnDefinitions>
  687. <!-- ContentPresenter to show an Icon if needed -->
  688. <ContentPresenter Margin="4,0,6,0" x:Name="Icon" VerticalAlignment="Center" ContentSource="Icon"/>
  689. <!-- Glyph is a checkmark if needed for a checkable menu -->
  690. <Grid Visibility="Hidden" Margin="4,0,6,0" x:Name="GlyphPanel" VerticalAlignment="Center">
  691. <Path x:Name="GlyphPanelpath" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z" FlowDirection="LeftToRight"/>
  692. </Grid>
  693. <!-- Content for the menu text etc -->
  694. <ContentPresenter Grid.Column="1" Margin="{TemplateBinding Padding}" x:Name="HeaderHost" RecognizesAccessKey="True" ContentSource="Header"/>
  695. <!-- Arrow drawn path which points to the next level of the menu -->
  696. <Grid Grid.Column="3" Margin="4,0,6,0" x:Name="ArrowPanel" VerticalAlignment="Center">
  697. <Path x:Name="ArrowPanelPath" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="M0,0 L0,8 L4,4 z"/>
  698. </Grid>
  699. <!-- The Popup is the body of the menu which expands down or across depending on the level of the item -->
  700. <Popup IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" x:Name="SubMenuPopup" Focusable="false" AllowsTransparency="true" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-3">
  701. <Grid x:Name="SubMenu">
  702. <Border x:Name="SubMenuBorder" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/>
  703. <!-- StackPanel holds children of the menu. This is set bu IsItemsHost=True -->
  704. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
  705. </Grid>
  706. </Popup>
  707. </Grid>
  708. </Border>
  709. <!-- These triggers re-configure the four arrangements of MenuItem to show different levels of menu via Role -->
  710. <ControlTemplate.Triggers>
  711. <!-- Role = TopLevelHeader : this is the root menu item in a menu; the Popup expands down -->
  712. <Trigger Property="Role" Value="TopLevelHeader">
  713. <Setter Property="Margin" Value="0,1,0,1"/>
  714. <Setter Property="Padding" Value="6,3,6,3"/>
  715. <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
  716. <Setter Property="Placement" Value="Bottom" TargetName="SubMenuPopup"/>
  717. <Setter Property="Visibility" Value="Collapsed" TargetName="ArrowPanel"/>
  718. </Trigger>
  719. <!-- Role = TopLevelItem : this is a child menu item from the top level without any child items-->
  720. <Trigger Property="Role" Value="TopLevelItem">
  721. <Setter Property="Margin" Value="0,1,0,1"/>
  722. <Setter Property="Padding" Value="6,3,6,3"/>
  723. <Setter Property="Visibility" Value="Collapsed" TargetName="ArrowPanel"/>
  724. </Trigger>
  725. <!-- Role = SubMenuHeader : this is a child menu item which does not have children -->
  726. <Trigger Property="Role" Value="SubmenuHeader">
  727. <Setter Property="DockPanel.Dock" Value="Top"/>
  728. <Setter Property="Padding" Value="0,2,0,2"/>
  729. <Setter Property="Grid.IsSharedSizeScope" Value="true"/>
  730. </Trigger>
  731. <!-- Role = SubMenuItem : this is a child menu item which has children-->
  732. <Trigger Property="Role" Value="SubmenuItem">
  733. <Setter Property="DockPanel.Dock" Value="Top"/>
  734. <Setter Property="Padding" Value="0,2,0,2"/>
  735. <Setter Property="Visibility" Value="Collapsed" TargetName="ArrowPanel"/>
  736. </Trigger>
  737. <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  738. <Setter Property="PopupAnimation" Value="None" TargetName="SubMenuPopup"/>
  739. </Trigger>
  740. <!-- If no Icon is present the we collapse the Icon Content -->
  741. <Trigger Property="Icon" Value="{x:Null}">
  742. <Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
  743. </Trigger>
  744. <!-- The GlyphPanel contains the CheckMark -->
  745. <Trigger Property="IsChecked" Value="true">
  746. <Setter Property="Visibility" Value="Visible" TargetName="GlyphPanel"/>
  747. <Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
  748. </Trigger>
  749. <Trigger Property="AllowsTransparency" SourceName="SubMenuPopup" Value="true">
  750. <Setter Property="Margin" Value="0,0,3,3" TargetName="SubMenu"/>
  751. <Setter Property="SnapsToDevicePixels" Value="true" TargetName="SubMenu"/>
  752. <Setter Property="BitmapEffect" Value="{DynamicResource PopupDropShadow}" TargetName="SubMenuBorder"/>
  753. </Trigger>
  754. <!-- Using the system colors for the Menu Highlight and IsEnabled-->
  755. <Trigger Property="IsHighlighted" Value="true">
  756. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" TargetName="Border"/>
  757. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
  758. </Trigger>
  759. <Trigger Property="IsEnabled" Value="false">
  760. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  761. </Trigger>
  762. </ControlTemplate.Triggers>
  763. </ControlTemplate>
  764. </Setter.Value>
  765. </Setter>
  766. </Style>
  767. <!-- Simple Separator - This template is used for a Separator in a menu -->
  768. <Style x:Key="SimpleSeparator" TargetType="{x:Type Separator}">
  769. <Setter Property="Height" Value="1"/>
  770. <Setter Property="Margin" Value="0,2,0,2"/>
  771. <Setter Property="Focusable" Value="false"/>
  772. <Setter Property="Template">
  773. <Setter.Value>
  774. <ControlTemplate TargetType="{x:Type Separator}">
  775. <Border BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/>
  776. </ControlTemplate>
  777. </Setter.Value>
  778. </Setter>
  779. </Style>
  780. <!-- Simple TabControl
  781. This template uses Simple TabItem for each Tab. The TabItems are placed in the TabPanel
  782. Limitations : The Simple TabControl only allow the Tabs to be shown at the top of the Tab control. You can re-position the TabPanel to change this-->
  783. <Style x:Key="SimpleTabControl" TargetType="{x:Type TabControl}">
  784. <Setter Property="Template">
  785. <Setter.Value>
  786. <ControlTemplate TargetType="{x:Type TabControl}">
  787. <Grid KeyboardNavigation.TabNavigation="Local">
  788. <Grid.RowDefinitions>
  789. <RowDefinition Height="Auto"/>
  790. <RowDefinition Height="*"/>
  791. </Grid.RowDefinitions>
  792. <!-- TabPanel is a layout container which allows the TabItems to wrap and re-order when selected
  793. The implementation knows to use this control because it is marked IsItemsHost = True -->
  794. <TabPanel Grid.Row="0" Margin="0,0,4,-1" x:Name="HeaderPanel" Background="Transparent" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1"/>
  795. <Border Grid.Row="1" x:Name="Border" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1" CornerRadius="2" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.TabIndex="2">
  796. <!-- The implementation switches the content. This control must be named PART_SelectedContentHost -->
  797. <ContentPresenter Margin="4" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
  798. </Border>
  799. </Grid>
  800. <ControlTemplate.Triggers>
  801. <Trigger Property="IsEnabled" Value="False">
  802. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  803. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  804. </Trigger>
  805. </ControlTemplate.Triggers>
  806. </ControlTemplate>
  807. </Setter.Value>
  808. </Setter>
  809. </Style>
  810. <!--Simple TabItem -->
  811. <Style x:Key="SimpleTabItem" d:IsControlPart="True" TargetType="{x:Type TabItem}">
  812. <Setter Property="Template">
  813. <Setter.Value>
  814. <ControlTemplate TargetType="{x:Type TabItem}">
  815. <Grid>
  816. <Border Margin="0,0,-4,0" x:Name="Border" Background="{DynamicResource LightBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1,1,1,1" CornerRadius="2,12,0,0">
  817. <ContentPresenter HorizontalAlignment="Center" Margin="12,2,12,2" x:Name="ContentSite" VerticalAlignment="Center" RecognizesAccessKey="True" ContentSource="Header"/>
  818. </Border>
  819. </Grid>
  820. <ControlTemplate.Triggers>
  821. <Trigger Property="IsSelected" Value="True">
  822. <Setter Property="Panel.ZIndex" Value="100"/>
  823. <Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}" TargetName="Border"/>
  824. <Setter Property="BorderThickness" Value="1,1,1,0" TargetName="Border"/>
  825. </Trigger>
  826. <Trigger Property="IsEnabled" Value="False">
  827. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  828. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  829. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
  830. </Trigger>
  831. </ControlTemplate.Triggers>
  832. </ControlTemplate>
  833. </Setter.Value>
  834. </Setter>
  835. </Style>
  836. <!--Simple Simple SliderThumb - The Thumb is the draggable part of a Slider-->
  837. <Style x:Key="SimpleSliderThumb" d:IsControlPart="True" TargetType="{x:Type Thumb}">
  838. <Setter Property="SnapsToDevicePixels" Value="true"/>
  839. <Setter Property="Height" Value="14"/>
  840. <Setter Property="Width" Value="14"/>
  841. <Setter Property="Template">
  842. <Setter.Value>
  843. <ControlTemplate TargetType="{x:Type Thumb}">
  844. <Grid>
  845. <Ellipse x:Name="Ellipse" Fill="{DynamicResource NormalBrush}" Stroke="{DynamicResource NormalBorderBrush}" StrokeThickness="1"/>
  846. </Grid>
  847. <ControlTemplate.Triggers>
  848. <Trigger Property="IsMouseOver" Value="True">
  849. <Setter Property="Fill" Value="{DynamicResource MouseOverBrush}" TargetName="Ellipse"/>
  850. </Trigger>
  851. <Trigger Property="IsEnabled" Value="false">
  852. <Setter Property="Fill" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Ellipse"/>
  853. </Trigger>
  854. </ControlTemplate.Triggers>
  855. </ControlTemplate>
  856. </Setter.Value>
  857. </Setter>
  858. </Style>
  859. <!--Simple Simple Slider
  860. Similiar to ScrollBar this template uses Track to layout the draggable Thumb which has an up and down repeat button
  861. It uses Simple SliderThumb and SimpleScrollRepeatButtonStyle for the page up and down repeat buttons -->
  862. <Style x:Key="SimpleSlider" TargetType="{x:Type Slider}">
  863. <Setter Property="Background" Value="{DynamicResource LightBrush}"/>
  864. <Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
  865. <Setter Property="Template">
  866. <Setter.Value>
  867. <ControlTemplate TargetType="{x:Type Slider}">
  868. <Grid x:Name="GridRoot">
  869. <Grid.RowDefinitions>
  870. <RowDefinition Height="Auto"/>
  871. <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
  872. <RowDefinition Height="Auto"/>
  873. </Grid.RowDefinitions>
  874. <!-- TickBar shows the ticks for Slider -->
  875. <TickBar Visibility="Collapsed" x:Name="TopTick" Height="4" SnapsToDevicePixels="True" Placement="Top" Fill="{DynamicResource GlyphBrush}"/>
  876. <Border Grid.Row="1" Margin="0" x:Name="Border" Height="4" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
  877. <!-- The Track lays out the repeat buttons and thumb -->
  878. <Track Grid.Row="1" x:Name="PART_Track">
  879. <Track.Thumb>
  880. <Thumb Style="{DynamicResource SimpleSliderThumb}"/>
  881. </Track.Thumb>
  882. <Track.IncreaseRepeatButton>
  883. <RepeatButton Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="Slider.IncreaseLarge"/>
  884. </Track.IncreaseRepeatButton>
  885. <Track.DecreaseRepeatButton>
  886. <RepeatButton Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="Slider.DecreaseLarge"/>
  887. </Track.DecreaseRepeatButton>
  888. </Track>
  889. <TickBar Visibility="Collapsed" Grid.Row="2" x:Name="BottomTick" Height="4" SnapsToDevicePixels="True" Placement="Bottom" Fill="{TemplateBinding Foreground}"/>
  890. </Grid>
  891. <ControlTemplate.Triggers>
  892. <Trigger Property="TickPlacement" Value="TopLeft">
  893. <Setter Property="Visibility" Value="Visible" TargetName="TopTick"/>
  894. </Trigger>
  895. <Trigger Property="TickPlacement" Value="BottomRight">
  896. <Setter Property="Visibility" Value="Visible" TargetName="BottomTick"/>
  897. </Trigger>
  898. <Trigger Property="TickPlacement" Value="Both">
  899. <Setter Property="Visibility" Value="Visible" TargetName="TopTick"/>
  900. <Setter Property="Visibility" Value="Visible" TargetName="BottomTick"/>
  901. </Trigger>
  902. <Trigger Property="IsEnabled" Value="false">
  903. <Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
  904. <Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
  905. </Trigger>
  906. <!-- Use a rotation to create a Vertical Slider form the default Horizontal -->
  907. <Trigger Property="Orientation" Value="Vertical">
  908. <Setter Property="LayoutTransform" TargetName="GridRoot">
  909. <Setter.Value>
  910. <RotateTransform Angle="-90"/>
  911. </Setter.Value>
  912. </Setter>
  913. <!-- Track rotates itself based on orientation so need to force it back -->
  914. <Setter TargetName="PART_Track" Property="Orientation" Value="Horizontal"/>
  915. </Trigger>
  916. </ControlTemplate.Triggers>
  917. </ControlTemplate>
  918. </Setter.Value>
  919. </Setter>
  920. </Style>
  921. <!--Simple Tree View - This lays out TreeViewItems within a ScrollViewer -->
  922. <Style x:Key="SimpleTreeView" TargetType="{x:Type TreeView}">
  923. <Setter Property="Template">
  924. <Setter.Value>
  925. <ControlTemplate TargetType="{x:Type TreeView}">
  926. <Grid>
  927. <Border x:Name="Border" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1" CornerRadius="1">
  928. <ScrollViewer Style="{DynamicResource SimpleScrollViewer}" Focusable="False" Background="{TemplateBinding Background}" Padding="4" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="False">
  929. <ItemsPresenter/>
  930. </ScrollViewer>
  931. </Border>
  932. </Grid>
  933. </ControlTemplate>
  934. </Setter.Value>
  935. </Setter>
  936. </Style>
  937. <!--Simple TreeViewItem ToggleButton - + and - button to expand and collapse a TreeViewItem -->
  938. <Style x:Key="SimpleTreeViewItemToggleButton" d:IsControlPart="True" TargetType="{x:Type ToggleButton}">
  939. <Setter Property="Focusable" Value="False"/>
  940. <Setter Property="Template">
  941. <Setter.Value>
  942. <ControlTemplate TargetType="{x:Type ToggleButton}">
  943. <Grid Width="15" Height="13" Background="Transparent">
  944. <Path Visibility="Collapsed" HorizontalAlignment="Left" Margin="1,1,1,1" x:Name="IsExpandedPath" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 0 4 L 8 4 L 4 8 Z"/>
  945. <Path HorizontalAlignment="Left" Margin="1,1,1,1" x:Name="ExpandPath" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 4 0 L 8 4 L 4 8 Z"/>
  946. </Grid>
  947. <ControlTemplate.Triggers>
  948. <Trigger Property="IsChecked" Value="True">
  949. <Setter Property="Visibility" Value="Visible" TargetName="IsExpandedPath"/>
  950. <Setter Property="Visibility" Value="Collapsed" TargetName="ExpandPath"/>
  951. </Trigger>
  952. </ControlTemplate.Triggers>
  953. </ControlTemplate>
  954. </Setter.Value>
  955. </Setter>
  956. </Style>
  957. <!--Simple TreeViewItem - The TreeViewItem template has a header which shows the Item and a Body which is an ItemsHost control which expands to show child items-->
  958. <Style x:Key="SimpleTreeViewItem" d:IsControlPart="True" TargetType="{x:Type TreeViewItem}">
  959. <Setter Property="Background" Value="Transparent"/>
  960. <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  961. <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  962. <Setter Property="Padding" Value="1,0,0,0"/>
  963. <Setter Property="Template">
  964. <Setter.Value>
  965. <ControlTemplate TargetType="{x:Type TreeViewItem}">
  966. <Grid>
  967. <Grid.ColumnDefinitions>
  968. <ColumnDefinition MinWidth="19" Width="Auto"/>
  969. <ColumnDefinition Width="Auto"/>
  970. <ColumnDefinition Width="*"/>
  971. </Grid.ColumnDefinitions>
  972. <Grid.RowDefinitions>
  973. <RowDefinition Height="Auto"/>
  974. <RowDefinition/>
  975. </Grid.RowDefinitions>
  976. <ToggleButton x:Name="Expander" Style="{DynamicResource SimpleTreeViewItemToggleButton}" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
  977. <Border Grid.Column="1" x:Name="Selection_Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
  978. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" x:Name="PART_Header" ContentSource="Header"/>
  979. </Border>
  980. <ItemsPresenter Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" x:Name="ItemsHost"/>
  981. </Grid>
  982. <ControlTemplate.Triggers>
  983. <Trigger Property="IsExpanded" Value="false">
  984. <Setter Property="Visibility" Value="Collapsed" TargetName="ItemsHost"/>
  985. </Trigger>
  986. <Trigger Property="HasItems" Value="false">
  987. <Setter Property="Visibility" Value="Hidden" TargetName="Expander"/>
  988. </Trigger>
  989. <Trigger Property="IsSelected" Value="true">
  990. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" TargetName="Selection_Border"/>
  991. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
  992. </Trigger>
  993. <MultiTrigger>
  994. <MultiTrigger.Conditions>
  995. <Condition Property="IsSelected" Value="true"/>
  996. <Condition Property="IsSelectionActive" Value="false"/>
  997. </MultiTrigger.Conditions>
  998. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" TargetName="Selection_Border"/>
  999. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  1000. </MultiTrigger>
  1001. <Trigger Property="IsEnabled" Value="false">
  1002. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  1003. </Trigger>
  1004. </ControlTemplate.Triggers>
  1005. </ControlTemplate>
  1006. </Setter.Value>
  1007. </Setter>
  1008. </Style>
  1009. </ResourceDictionary>