In my product, we have several close buttons which all have a red background. I'd like to style the close buttons in the Document Windows as red as well, but I can't figure out how. I imagine it is easy, but can you help me with this?
In my product, we have several close buttons which all have a red background. I'd like to style the close buttons in the Document Windows as red as well, but I can't figure out how. I imagine it is easy, but can you help me with this?
Hi Doug,
You'd probably need to clone and update the default AdvancedTabItem style and make a new one whose Template had the button alteration. You could assign the resulting Style to the TabbedMdiHost.TabItemContainerStyle property. The default Style for that property looks like this and inherits the default AdvancedTabItem control Template:
<Style TargetType="docking:AdvancedTabItem">
<Setter Property="Header" Value="{Binding TabTextResolved}" />
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
To sum up, you'd need to take the XAML above, add a new Template Setter with an altered ControlTemplate that has your close button changes, and put the Style in the TabbedMdiHost.TabItemContainerStyle property.
Your company has licensed WPF Studio so you can have whoever is listed on the Actipro account get the 2016.1 default styles/templates for you.
I was able to do what I wanted by overriding the CloseButtonContentTemplate. This seems simpler than your solution although I believe your method would be more flexible.
That might work ok for your needs. Just keep in mind that that particular template is for the content of the button and doesn't control any chrome (borders, padding, etc.) it might have.
Good point. For me, this works but in general restyling the button requires your approach.
Please log in to a validated account to post comments.