Reputation: 3131
How can I set the first TabItem
inside a TabControl
with a custom style:
<Style TargetType="{x:Type TabControl}">
<Style.Resources>
<Style TargetType="{x:Type TabItem}">
...
What I'm trying to archive is to get the first TabItem
with a left margin, and the others with margin = 0.
To illustrate what I'm trying to do:
How the tab control looks now:
How it should look (space before the first TabItem):
A different approach with the same results is also useful.
Upvotes: 0
Views: 93
Reputation: 13710
What you could do to achieve this is simply add an invisible, empty TabItem at first position:
<TabItem Visibility="Hidden"/>
Hidden
will cause that the tab control is not shown, but space is anyway reserved for it, so it turns out to look like something like that:
The space can be simply enlarged by choosing a Header
for the TabItem
with the appropriate amount of characters
Alternatively you can simply add some margin to the first TabItem
itself
<TabItem Header="TabItem1" Margin="5,0,0,0">
but that might result in that the Name of TabItem1 is cut off at the right side
Upvotes: 1