Harry Harry - 3 months ago 16
C# Question

How to change tab header border color?

I have

TabControl
element.

Tab style

I changed
TabControl
's
BorderBrush
to red, as shown.
What drives me mad is I cannot have the same color on the tab itself.

I tried many examples, like WPF TabItem Header Styling , but no joy.
The border I want to change is not a part of
Header
element. The
Header
element is inside that thing I want to change.

I tried to use complete template from https://msdn.microsoft.com/en-us/library/ms754137(v=vs.110).aspx , no joy, looks fugly and I have no idea how to even begin to make it look how it should look.

Where can I get the original template to modify? I just want to change the border color, nothing else. I don't mind pasting and editing a huge template, but I need the correct, actual template.

(I use .NET Framework 4.6.2.)

Answer

In the XAML Design mode, right click on your TabControl, and on the context menu select Edit Template | Edit a Copy.... That'll get you the actual template that's really in use there (at least as far as the XAML Designer knows at design time), not some cheeseball example thing from MSDN.

As for editing that template once you've got it... that which doesn't kill you makes you stronger. Usually.

enter image description here

Comments