我正在爲TabControl創建新樣式,包括項目的新ItemContainerStyle。新的樣式工作正常,除了我需要使用樣式時添加功能到ItemContainerStyle的可能性。詳細說明這是標題屬性覆蓋樣式的特定屬性
<TabControl x:Name="myTabControl" SelectionChanged="myTabControl_SelectionChanged">
<TabControl.ItemContainerStyle>
<Style TargetType="TabItem">
<Setter Property="Header" Value="{Binding Title}"></Setter>
</Style>
</TabControl.ItemContainerStyle>
</TabControl>
它的工作正常。但它完全覆蓋了風格。 BasedOn屬性會有所幫助,但是我無法訪問ItemContainerStyle的鍵,因爲它嵌入在TabControls的樣式中。我怎樣才能簡單地更新樣式屬性而不會完全覆蓋樣式?
謝謝
你動態地創建標籤的項目? –