【问题标题】:Style only 1 tab of a tab control binded to an itemsource仅样式绑定到 itemsource 的选项卡控件的 1 个选项卡
【发布时间】:2011-06-05 17:06:00
【问题描述】:

我有一个标签控件:

 <TabControl IsSynchronizedWithCurrentItem="True" 
                ItemsSource="{Binding}"
                ItemTemplate="{StaticResource ClosableTabItemTemplate}"
                >
    </TabControl>

我只想将第一个选项卡项的样式设置为某种样式。通常,我可以使用这种方式,

<TabControl>
        <TabItem Style="{StaticResource SomeStyle}">
        </TabItem>
        <TabItem>

        </TabItem>
    </TabControl>

但这是不可能的,因为选项卡项是从 ItemsSource 生成的。

如果需要,这里是 TabControl ItemTemplate:

  <DataTemplate x:Key="TabItemTemplate">
    <DockPanel>
        <ContentPresenter Content="{Binding Path=VMName}" 
                          VerticalAlignment="Center" 
                          HorizontalAlignment="Center"/>
    </DockPanel>
</DataTemplate>

【问题讨论】:

    标签: c# .net wpf


    【解决方案1】:
    猜你喜欢
    • 2011-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-23
    • 1970-01-01
    相关资源
    最近更新 更多