Kiang Teng
Kiang Teng

Reputation: 1705

Style only 1 tab of a tab control binded to an itemsource

alt text

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

Answers (1)

Related Questions