Reputation: 1705
I have a tab control:
<TabControl IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource ClosableTabItemTemplate}"
>
</TabControl>
I want to set the style of only the 1st tab item to some style. Normally, I can do it using this way,
<TabControl>
<TabItem Style="{StaticResource SomeStyle}">
</TabItem>
<TabItem>
</TabItem>
</TabControl>
But this isn't possible as the tab items are generated from an ItemsSource.
If needed, here is the TabControl ItemTemplate:
<DataTemplate x:Key="TabItemTemplate">
<DockPanel>
<ContentPresenter Content="{Binding Path=VMName}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</DockPanel>
</DataTemplate>
Upvotes: 0
Views: 463
Reputation: 18000
You can use the TabControl.ContentTemplateSelector Property.
Also read this http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/
Upvotes: 2