Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can either do like in the code below,specifieing style for individual tabitems giving a key for the style resource</p> <pre><code>&lt;Window.Resources&gt; &lt;Style TargetType="{x:Type TabItem}" x:Key="TabItemStyle1"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabItem}"&gt; &lt;Grid&gt; ------------ ------------ &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;Style TargetType="{x:Type TabItem}" x:Key="TabItemStyle2"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabItem}"&gt; &lt;Grid&gt; ------------ ------------ &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;TabControl Height="181" VerticalAlignment="Top"&gt; &lt;TabItem Header="Cheese" Style="{StaticResource TabItemStyle1} /&gt; &lt;TabItem Header="Pepperoni" Style="{StaticResource TabItemStyle1} /&gt; &lt;TabItem Header="Mushrooms" Style="{StaticResource TabItemStyle1} /&gt; &lt;/TabControl&gt; &lt;TabControl Margin="0,201,0,60"&gt; &lt;TabItem Header="Cheese" Style="{StaticResource TabItemStyle2} /&gt; &lt;TabItem Header="Pepperoni" Style="{StaticResource TabItemStyle2} /&gt; &lt;TabItem Header="Mushrooms" Style="{StaticResource TabItemStyle2} /&gt; &lt;/TabControl&gt; &lt;/Grid&gt; </code></pre> <p>or you can use control level style resources</p> <pre><code>&lt;Grid&gt; &lt;TabControl Height="181" VerticalAlignment="Top"&gt; &lt;TabControl.Resources&gt; &lt;Style TargetType="{x:Type TabItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabItem}"&gt; &lt;Grid&gt; ------------ ------------ &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/TabControl.Resources&gt; &lt;TabItem Header="Cheese" /&gt; &lt;TabItem Header="Pepperoni" /&gt; &lt;TabItem Header="Mushrooms" /&gt; &lt;/TabControl&gt; &lt;TabControl Margin="0,201,0,60"&gt; &lt;TabControl.Resources&gt; &lt;Style TargetType="{x:Type TabItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabItem}"&gt; &lt;Grid&gt; ------------ ------------ &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/TabControl.Resources&gt; &lt;TabItem Header="Cheese" /&gt; &lt;TabItem Header="Pepperoni" /&gt; &lt;TabItem Header="Mushrooms" /&gt; &lt;/TabControl&gt; &lt;/Grid&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload