1+ <ResourceDictionary xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+ xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
3+ xmlns : Actions =" clr-namespace:MahApps.Metro.Actions"
4+ xmlns : controls =" clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" >
5+
6+
7+ <!-- https://github.com/MahApps/MahApps.Metro/blob/0dffed2b9a98ed928d3ac0b5c8d5c7708f1aa413/src/MahApps.Metro/Styles/VS/TabControl.xaml-->
8+
9+ <ResourceDictionary .MergedDictionaries>
10+ <ResourceDictionary Source =" pack://application:,,,/MahApps.Metro;component/Styles/Controls.TabControl.xaml" />
11+ </ResourceDictionary .MergedDictionaries>
12+
13+ <Style x : Key =" NonClosableTabItem" BasedOn =" {StaticResource {x:Type controls:MetroTabItem}}" TargetType =" {x:Type controls:MetroTabItem}" >
14+ <Setter Property =" CloseButtonEnabled" Value =" False" ></Setter >
15+
16+ <Setter Property =" BorderBrush" Value =" {DynamicResource BorderBrushNormal}" />
17+ <!-- special property for header font size -->
18+ <!-- <Setter Property="controls:ControlsHelper.HeaderFontSize" Value="12" />-->
19+ <Setter Property =" controls:TabControlHelper.CloseButtonEnabled" Value =" True" />
20+ <Setter Property =" Padding" Value =" 12 5 12 5" />
21+ <!-- <Setter Property="controls:ControlsHelper.HeaderFontSize" Value="20"></Setter>-->
22+ <Setter Property =" Template" >
23+ <Setter .Value>
24+ <ControlTemplate TargetType =" {x:Type TabItem}" >
25+ <Border x : Name =" Border"
26+ HorizontalAlignment =" Stretch"
27+ Background =" {TemplateBinding Background}"
28+ BorderBrush =" {TemplateBinding BorderBrush}"
29+ BorderThickness =" {TemplateBinding BorderThickness}"
30+ SnapsToDevicePixels =" {TemplateBinding SnapsToDevicePixels}" >
31+ <StackPanel x : Name =" PART_Content"
32+ HorizontalAlignment =" Stretch"
33+ VerticalAlignment =" Stretch"
34+ Orientation =" Horizontal" >
35+ <controls : ContentControlEx x : Name =" ContentSite"
36+ Padding =" {TemplateBinding Padding}"
37+ Content =" {TemplateBinding Header}"
38+ ContentCharacterCasing =" {Binding RelativeSource={RelativeSource TemplatedParent}, Path=(controls:ControlsHelper.ContentCharacterCasing)}"
39+ ContentStringFormat =" {TemplateBinding HeaderStringFormat}"
40+ ContentTemplate =" {TemplateBinding HeaderTemplate}"
41+ ContentTemplateSelector =" {TemplateBinding HeaderTemplateSelector}"
42+ DockPanel.Dock=" Top"
43+ FontFamily =" {TemplateBinding FontFamily}"
44+ FontStyle =" {TemplateBinding FontStyle}"
45+
46+ Foreground =" {TemplateBinding Foreground}"
47+ RecognizesAccessKey =" True"
48+ SnapsToDevicePixels =" {TemplateBinding SnapsToDevicePixels}" />
49+ <Button x : Name =" PART_CloseButton"
50+ VerticalAlignment =" Center"
51+ IsTabStop =" False"
52+ Style =" {DynamicResource StandardTabItemCloseButtonStyle}"
53+ Visibility =" {Binding RelativeSource={RelativeSource TemplatedParent}, Path=(controls:TabControlHelper.CloseButtonEnabled), Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" >
54+ </Button >
55+ </StackPanel >
56+ </Border >
57+ <ControlTemplate .Triggers>
58+ <Trigger Property =" TabStripPlacement" Value =" Left" >
59+ <Setter TargetName =" PART_Content" Property =" LayoutTransform" >
60+ <Setter .Value>
61+ <TransformGroup >
62+ <ScaleTransform />
63+ <SkewTransform />
64+ <RotateTransform Angle =" -90" />
65+ <TranslateTransform />
66+ </TransformGroup >
67+ </Setter .Value>
68+ </Setter >
69+ </Trigger >
70+ <Trigger Property =" TabStripPlacement" Value =" Right" >
71+ <Setter TargetName =" PART_Content" Property =" LayoutTransform" >
72+ <Setter .Value>
73+ <TransformGroup >
74+ <ScaleTransform />
75+ <SkewTransform />
76+ <RotateTransform Angle =" 90" />
77+ <TranslateTransform />
78+ </TransformGroup >
79+ </Setter .Value>
80+ </Setter >
81+ </Trigger >
82+ <Trigger Property =" IsSelected" Value =" true" >
83+ <Setter Property =" Background" Value =" {DynamicResource MahApps.Brushes.BackgroundSelected}" />
84+ <Setter Property =" BorderBrush" Value =" {DynamicResource MahApps.Brushes.Border.Selected}" />
85+ </Trigger >
86+ <Trigger Property =" IsMouseOver" Value =" True" >
87+ <Setter Property =" Background" Value =" {DynamicResource MahApps.Brushes.BackgroundHighlighted}" />
88+ <Setter Property =" BorderBrush" Value =" {DynamicResource MahApps.Brushes.Border.Highlighted}" />
89+ </Trigger >
90+ <MultiTrigger >
91+ <MultiTrigger .Conditions>
92+ <Condition Property =" IsMouseOver" Value =" False" />
93+ <Condition Property =" IsSelected" Value =" False" />
94+ <Condition Property =" controls:TabControlHelper.CloseButtonEnabled" Value =" True" />
95+ </MultiTrigger .Conditions>
96+ <Setter TargetName =" PART_CloseButton" Property =" Visibility" Value =" Hidden" />
97+ </MultiTrigger >
98+ <MultiTrigger >
99+ <MultiTrigger .Conditions>
100+ <Condition Property =" IsMouseOver" Value =" True" />
101+ <Condition Property =" IsSelected" Value =" True" />
102+ </MultiTrigger .Conditions>
103+ <Setter Property =" Background" Value =" {DynamicResource MahApps.Brushes.BackgroundSelected}" />
104+ <Setter Property =" BorderBrush" Value =" {DynamicResource MahApps.Brushes.Border.Selected}" />
105+ </MultiTrigger >
106+ </ControlTemplate .Triggers>
107+ </ControlTemplate >
108+ </Setter .Value>
109+ </Setter >
110+ </Style >
111+
112+ </ResourceDictionary >
0 commit comments