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