forked from MahApps/MahApps.Metro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTabControlExamples.xaml
376 lines (363 loc) · 22.8 KB
/
TabControlExamples.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<UserControl x:Class="MetroDemo.ExampleViews.TabControlExamples"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:MetroDemo="clr-namespace:MetroDemo"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MetroDemo.ExampleViews"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{d:DesignInstance MetroDemo:MainWindowViewModel}"
d:DesignHeight="600"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<ObjectDataProvider x:Key="TabStripPlacementEnumValues"
MethodName="GetValues"
ObjectType="{x:Type Dock}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="Dock" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="UnderlinedEnumValues"
MethodName="GetValues"
ObjectType="{x:Type Controls:UnderlinedType}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="Controls:UnderlinedType" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="UnderlinePlacementEnumValues"
MethodName="GetDockValues"
ObjectType="{x:Type local:DockHelper}" />
<ControlTemplate x:Key="TabControlConfigDataTemplate">
<Grid d:DataContext="{d:DesignInstance TabControl}">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="Underlined type" />
<ComboBox x:Name="UnderlinedComboBox"
Width="100"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource UnderlinedEnumValues}}"
SelectedItem="{Binding Path=(Controls:TabControlHelper.Underlined), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="TabStripPlacement" />
<ComboBox x:Name="TabStripPlacementComboBox"
Width="100"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource TabStripPlacementEnumValues}}"
SelectedItem="{Binding Path=TabStripPlacement, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="UnderlinePlacement" />
<ComboBox x:Name="UnderlinePlacementComboBox"
Width="100"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource UnderlinePlacementEnumValues}}"
SelectedItem="{Binding Path=(Controls:TabControlHelper.UnderlinePlacement), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="MetroTabControlConfigDataTemplate">
<Grid d:DataContext="{d:DesignInstance Controls:MetroTabControl}">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="Keep VisualTree in memory" />
<CheckBox x:Name="KeepVisualTreeInMemoryCheckBox"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
IsChecked="{Binding Path=KeepVisualTreeInMemoryWhenChangingTabs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="Underlined type" />
<ComboBox x:Name="UnderlinedComboBox"
Width="100"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource UnderlinedEnumValues}}"
SelectedItem="{Binding Path=(Controls:TabControlHelper.Underlined), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="TabStripPlacement" />
<ComboBox x:Name="TabStripPlacementComboBox"
Width="100"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource TabStripPlacementEnumValues}}"
SelectedItem="{Binding Path=TabStripPlacement, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="5 5"
VerticalAlignment="Center"
Text="UnderlinePlacement" />
<ComboBox x:Name="UnderlinePlacementComboBox"
Width="100"
Margin="5 5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding Source={StaticResource UnderlinePlacementEnumValues}}"
SelectedItem="{Binding Path=(Controls:TabControlHelper.UnderlinePlacement), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</Grid>
</ControlTemplate>
</UserControl.Resources>
<StackPanel Margin="5 10 5 0">
<Expander Margin="0"
Header="_Default TabControl"
IsExpanded="True">
<StackPanel Margin="15 5 15 5">
<Label Content="Default TabControl" Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=DefaultTabControl}" Template="{StaticResource TabControlConfigDataTemplate}" />
<TabControl x:Name="DefaultTabControl"
Height="200"
Controls:HeaderedControlHelper.HeaderFontFamily="Segoe Script"
Controls:HeaderedControlHelper.HeaderFontSize="18">
<TabItem Header="Item _1">
<TextBlock FontSize="30" Text="Content" />
</TabItem>
<TabItem Header="Item _2">
<TextBlock FontSize="30" Text="More content" />
</TabItem>
<TabItem Header="Item _3">
<TextBlock FontSize="30" Text="More more content" />
</TabItem>
<TabItem Header="Item _4">
<TextBlock FontSize="30" Text="So much content!" />
</TabItem>
<TabItem Header="Item _5">
<TextBlock FontSize="30" Text="Content!" />
</TabItem>
<TabItem Header="Item _6">
<TextBlock FontSize="30" Text="This is not content (it is)" />
</TabItem>
</TabControl>
<Label Margin="0 5 0 0"
Content="Default TabControl with _AnimatedTabControl style"
Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=AnimatedTabControl}" Template="{StaticResource TabControlConfigDataTemplate}" />
<Grid>
<Grid.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
</Grid.Resources>
<TabControl x:Name="AnimatedTabControl" Height="150">
<TabItem Header="this tabcontrol">
<TextBlock FontSize="30" Text="Cool transition" />
</TabItem>
<Controls:MetroTabItem Header="animates its content">
<TextBlock FontSize="30" Text="More cool transition" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="with a transition">
<TextBlock FontSize="30" Text="Animate everything!" />
</Controls:MetroTabItem>
</TabControl>
</Grid>
<Label Margin="0 5 0 0"
Content="Default TabControl with Animated_SingleRowTabControl style"
Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=AnimatedSingleRowTabControl}" Template="{StaticResource TabControlConfigDataTemplate}" />
<Grid>
<Grid.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
</Grid.Resources>
<TabControl x:Name="AnimatedSingleRowTabControl" Height="150">
<TabItem Header="these tabs">
<TextBlock FontSize="30" Text="first content" />
</TabItem>
<Controls:MetroTabItem Header="appear only on a single line">
<TextBlock FontSize="30" Text="second one" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="if they are overflowing">
<TextBlock FontSize="30" Text="3" />
</Controls:MetroTabItem>
<TabItem Header="instead of wrapping them">
<TextBlock FontSize="30" Text="last of them" />
</TabItem>
</TabControl>
</Grid>
</StackPanel>
</Expander>
<Expander Margin="0 10 0 0"
Header="_Generic theme TabControls"
IsExpanded="True">
<StackPanel Margin="15 5 15 5">
<Label Content="MetroAnimatedTabControl" Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=MetroAnimatedTabControl}" Template="{StaticResource TabControlConfigDataTemplate}" />
<Controls:MetroAnimatedTabControl x:Name="MetroAnimatedTabControl" Height="150">
<TabItem Header="this tabcontrol">
<TextBlock FontSize="30" Text="Cool transition" />
</TabItem>
<Controls:MetroTabItem Header="animates its content">
<TextBlock FontSize="30" Text="More cool transition" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="with a transition">
<TextBlock FontSize="30" Text="Animate everything!" />
</Controls:MetroTabItem>
</Controls:MetroAnimatedTabControl>
<Label Margin="0 5 0 0"
Content="MetroAnimatedSingleRowTabControl"
Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=MetroAnimatedSingleRowTabControl}" Template="{StaticResource TabControlConfigDataTemplate}" />
<Controls:MetroAnimatedSingleRowTabControl x:Name="MetroAnimatedSingleRowTabControl" Height="150">
<TabItem Header="these tabs">
<TextBlock FontSize="30" Text="first content" />
</TabItem>
<Controls:MetroTabItem Header="appear only on a single line">
<TextBlock FontSize="30" Text="second one" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="if they are overflowing">
<TextBlock FontSize="30" Text="3" />
</Controls:MetroTabItem>
<TabItem Header="instead of wrapping them">
<TextBlock FontSize="30" Text="last of them" />
</TabItem>
</Controls:MetroAnimatedSingleRowTabControl>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Controls:MetroAnimatedSingleRowTabControl Height="100" TabStripPlacement="Left">
<TabControl.Resources>
<Style BasedOn="{StaticResource {x:Type TabItem}}" TargetType="{x:Type TabItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<ContentPresenter Content="{TemplateBinding Content}">
<ContentPresenter.LayoutTransform>
<RotateTransform Angle="270" />
</ContentPresenter.LayoutTransform>
</ContentPresenter>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<TabItem Header="Test1">
<TextBlock FontSize="12" Text="TabStripPlacement Left Test 1" />
</TabItem>
<TabItem Header="Test2">
<TextBlock FontSize="12" Text="TabStripPlacement Left Test 2" />
</TabItem>
<TabItem Header="Test3">
<TextBlock FontSize="12" Text="TabStripPlacement Left Test 3" />
</TabItem>
</Controls:MetroAnimatedSingleRowTabControl>
<Controls:MetroAnimatedSingleRowTabControl Grid.Column="1"
Height="100"
TabStripPlacement="Right">
<TabControl.Resources>
<Style BasedOn="{StaticResource {x:Type TabItem}}" TargetType="{x:Type TabItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<ContentPresenter Content="{TemplateBinding Content}">
<ContentPresenter.LayoutTransform>
<RotateTransform Angle="90" />
</ContentPresenter.LayoutTransform>
</ContentPresenter>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<TabItem Header="Test1">
<TextBlock FontSize="12" Text="TabStripPlacement Right Test 1" />
</TabItem>
<TabItem Header="Test2">
<TextBlock FontSize="12" Text="TabStripPlacement Right Test 2" />
</TabItem>
<TabItem Header="Test3">
<TextBlock FontSize="12" Text="TabStripPlacement Right Test 3" />
</TabItem>
</Controls:MetroAnimatedSingleRowTabControl>
</Grid>
<Label Margin="0 5 0 0"
Content="MetroTabControl w/ Closable Items"
Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=MetroTabControlClosable}" Template="{StaticResource MetroTabControlConfigDataTemplate}" />
<Controls:MetroTabControl x:Name="MetroTabControlClosable" TabItemClosingEvent="MetroTabControl_TabItemClosingEvent">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="20"
CloseButtonEnabled="True"
CloseTabCommand="{Binding SingleCloseTabCommand}"
CloseTabCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Header}"
Header="headers">
<TextBlock FontSize="30" Text="you can bind to a command" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="22"
CloseButtonEnabled="True"
CloseTabCommand="{Binding NeverCloseTabCommand}"
CloseTabCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Header}"
Header="can">
<TextBlock FontSize="30" Text="and ensure the command never closes" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="24"
CloseButtonEnabled="True"
Header="have">
<TextBlock FontSize="30" Text="More more content" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="26"
CloseButtonEnabled="True"
Header="different">
<TextBlock FontSize="30" Text="So much content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="28"
CloseButtonEnabled="True"
Header="font">
<TextBlock FontSize="30" Text="Content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="30"
CloseButtonEnabled="True"
Header="sizes">
<TextBlock FontSize="30" Text="This is not content (it is). This one won't close." />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="36"
CloseButtonEnabled="True"
Header="close button">
<TextBlock FontSize="24" Text="The size of close button will be changed proportionately considering its header size." />
</Controls:MetroTabItem>
</Controls:MetroTabControl>
<Label Margin="0 5 0 0"
Content="MetroTabControl style"
Style="{DynamicResource DescriptionHeaderStyle}" />
<ContentControl DataContext="{Binding ElementName=MetroTabControl}" Template="{StaticResource MetroTabControlConfigDataTemplate}" />
<Controls:MetroTabControl x:Name="MetroTabControl"
Height="200"
KeepVisualTreeInMemoryWhenChangingTabs="True">
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _1">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="30" Text="Load-Count: " />
<TextBlock FontSize="30"
Loaded="TextBlock_OnLoaded"
Text="0" />
</StackPanel>
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _2 more">
<TextBlock FontSize="30" Text="More content" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _3 header here">
<TextBlock FontSize="30" Text="More more content" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _4 ">
<TextBlock FontSize="30" Text="So much content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18"
CloseButtonEnabled="True"
Header="item _5">
<TextBlock FontSize="30" Text="Content!" />
</Controls:MetroTabItem>
<Controls:MetroTabItem Controls:HeaderedControlHelper.HeaderFontSize="18" Header="item _6">
<TextBlock FontSize="30" Text="This is not content (it is)" />
</Controls:MetroTabItem>
</Controls:MetroTabControl>
</StackPanel>
</Expander>
</StackPanel>
</UserControl>