Set TabPage Header Color

If you want to color the tabs, try the following code: this.tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed; this.tabControl1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.tabControl1_DrawItem); private Dictionary<TabPage, Color> TabColors = new Dictionary<TabPage, Color>(); private void SetTabHeader(TabPage page, Color color) { TabColors[page] = color; tabControl1.Invalidate(); } private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { //e.DrawBackground(); using (Brush br = new SolidBrush (TabColors[tabControl1.TabPages[e.Index]])) { e.Graphics.FillRectangle(br, … Read more

How to fix this behavior in a WPF TabControl?

A simplified example. Collection item: using Simplified; namespace AddTabItem { public class TabVm : BaseInpc { string _header; bool _isPlaceholder; private string _text; public string Header { get => _header; set => Set(ref _header, value); } public bool IsPlaceholder { get => _isPlaceholder; set => Set(ref _isPlaceholder, value); } public string Text { get => … Read more

Hide Tab Header on C# TabControl

Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. It shows the tabs at design time so you can easily switch between them while designing. They are hidden at runtime, use the SelectedTab or SelectedIndex property in … Read more

WPF TabControl – Preventing Unload on Tab Change?

I found a workaround here: https://web.archive.org/web/20120429044747/http://eric.burke.name/dotnetmania/2009/04/26/22.09.28 Edit: This is the corrected link: http://web.archive.org/web/20110825185059/http://eric.burke.name/dotnetmania/2009/04/26/22.09.28 It basically stores the ContentPresenter of the tab and loads that up when switching tabs instead of redrawing it. It was still causing the delay when dragging/dropping tabs since that was an remove/add operation, however with some modifications I got that to … Read more