Ghost1372

everything can be handy

TabControl

TabControlBaseStyle

The default style of the tabcontrol is not recommended. It should always be used by other styles as BasedOn.

Case:

1
2
3
4
5
6
7
8
<TabControl Margin="10">
<TabItem Header="Tab 1">
</TabItem>
<TabItem Header="Tab 2">
</TabItem>
<TabItem Header="Tab 3">
</TabItem>
</TabControl>

effect::

TabControl.DefaultStyle

TabControlInLine : TabControlBaseStyle

Single line fill tab style

Case:

1
2
3
4
5
6
7
8
<TabControl Margin="10" Style="{StaticResource TabControlInLine}">
<TabItem Header="Tab 1">
</TabItem>
<TabItem Header="Tab 2">
</TabItem>
<TabItem Header="Tab 3">
</TabItem>
</TabControl>

effect::

TabControl.InLineStyle

TabControlCapsule

Capsule tab style

Case:

1
2
3
4
5
6
7
8
<TabControl Margin="10" Style="{StaticResource TabControlCapsule}">
<TabItem Header="Tab 1">
</TabItem>
<TabItem Header="Tab 2">
</TabItem>
<TabItem Header="Tab 3">
</TabItem>
</TabControl>

effect::

TabControl.CapsuleStyle

TabControlCapsuleSolid : TabControlCapsule

Capsule (solid) tab style

Case:

1
2
3
4
5
6
7
8
<TabControl Margin="10" Style="{StaticResource TabControlCapsuleSolid}">
<TabItem Header="Tab 1">
</TabItem>
<TabItem Header="Tab 2">
</TabItem>
<TabItem Header="Tab 3">
</TabItem>
</TabControl>

effect::

TabControl.CapsuleSolidStyle

Tips

You can use the property TabStripPlacement to set the position of the header title, the effect is as follows:

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
<UniformGrid Rows="2" Columns="2" Margin="16">
<TabControl TabStripPlacement="Right" Margin="16" Width="400" Height="200">
<TabItem Header="Title" HeaderStringFormat="{}{0}1">
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="1"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}2" IsEnabled="False">
<Border Background="{DynamicResource SuccessBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="2"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}3">
<Border Background="{DynamicResource InfoBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="3"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}4">
<Border Background="{DynamicResource WarningBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="4"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}5">
<Border Background="{DynamicResource DangerBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="5"/>
</TextBlock>
</Border>
</TabItem>
</TabControl>
<TabControl Margin="16" Width="400" Height="200" Style="{StaticResource TabControlInLine}">
<TabItem Header="Title" HeaderStringFormat="{}{0}1">
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="1"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}2">
<Border Background="{DynamicResource SuccessBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="2"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}3">
<Border Background="{DynamicResource InfoBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="3"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}4">
<Border Background="{DynamicResource WarningBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="4"/>
</TextBlock>
</Border>
</TabItem>
<TabItem IsSelected="True" Header="Title" HeaderStringFormat="{}{0}5">
<Border Background="{DynamicResource DangerBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="5"/>
</TextBlock>
</Border>
</TabItem>
</TabControl>
<TabControl TabStripPlacement="Left" Margin="16" Width="400" Height="200" Style="{StaticResource TabControlCapsule}">
<TabItem Header="Title" HeaderStringFormat="{}{0}1">
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="1"/>
</TextBlock>
</Border>
</TabItem>
<TabItem IsSelected="True" Header="Title" HeaderStringFormat="{}{0}2">
<Border Background="{DynamicResource SuccessBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="2"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}3">
<Border Background="{DynamicResource InfoBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="3"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}4">
<Border Background="{DynamicResource WarningBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="4"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}5">
<Border Background="{DynamicResource DangerBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="5"/>
</TextBlock>
</Border>
</TabItem>
</TabControl>
<TabControl TabStripPlacement="Bottom" Margin="16" Width="400" Height="200" Style="{StaticResource TabControlCapsuleSolid}">
<TabItem Header="Title" HeaderStringFormat="{}{0}1">
<Border Background="{DynamicResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="1"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}2" IsEnabled="False">
<Border Background="{DynamicResource SuccessBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="2"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}3">
<Border Background="{DynamicResource InfoBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="3"/>
</TextBlock>
</Border>
</TabItem>
<TabItem IsSelected="True" Header="Title" HeaderStringFormat="{}{0}4">
<Border Background="{DynamicResource WarningBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="4"/>
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}5">
<Border Background="{DynamicResource DangerBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
<Run Text="Text"/>
<Run Text="5"/>
</TextBlock>
</Border>
</TabItem>
</TabControl>
</UniformGrid>

TabControl.TabStripPlacement

TabItemTransparentStyle Only Custom Version

1
2
3
<TabControl>
<TabItem Header="Test" Style={StaticResource TabItemTransparentStyle}>
</TabControl>

TabControlSliding

TabItemSliding

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
<TabControl SelectedIndex="3" Style="{StaticResource TabControlSliding}">
<TabItem Header="Title" HeaderStringFormat="{}{0}1">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="1" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}22" IsEnabled="False">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="2" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}333">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="3" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}4444">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="4" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}55555">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="5" />
</TextBlock>
</Border>
</TabItem>
</TabControl>
<TabControl Style="{StaticResource TabControlSliding}" TabStripPlacement="Bottom">
<TabItem Header="Title" HeaderStringFormat="{}{0}1">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="1" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}22" IsEnabled="False">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="2" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}333">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="3" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}4444">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="4" />
</TextBlock>
</Border>
</TabItem>
<TabItem Header="Title" HeaderStringFormat="{}{0}55555">
<Border>
<TextBlock Style="{StaticResource TextBlockLargeBold}">
<Run Text="Text" />
<Run Text="5" />
</TextBlock>
</Border>
</TabItem>
</TabControl>
0%