How to set the default style for tabitem in a tabcontrol's style
I'm creating a specific style for some TabControl in my application.
<开发者_JS百科;TabControl Style="{StaticResource MyTabControl}">
</TabControl>
I want to also style TabItem in the case of this specific TabControl's Style.
For now, I must write :
<TabControl Style="{StaticResource MyTabControl}">
<TabItem Style="{StaticResource MyTabItem}" Header="First" />
<TabItem Style="{StaticResource MyTabItem}" Header="Second" />
</TabControl>
Instead of having to specify the "MyTabItem" style on each TabItem, is there any way to set the default TabItem style only in the scope of a specific TabControl Style ?
I didn't found a way to specify, in the style of my TabControl, which style should be applied on all children TabItems.
<TabControl ItemContainerStyle="{StaticResource MyTabItem}"/>
put style for target type TabItem as a implicit style under your MyTabItem style resource
<Style TargetType="TabControl" x:Key="TabControlStyle">
<Style.Resources>
<Style TargetType="TabItem">
</Style>
精彩评论