Category / Section
How to customize the header foreground of WinForms XPTaskBar while apply other than default style?
1 min read
Customize the header foreground
XPTaskBar ForeColor and BackColor appearance has been customized based on its Visual Style. Hence to use different Visual Style in XPTaskBar other than default, it is needed to enable property named UseCustomColors. The following code demonstrates the same.
C#
this.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Metro; XPTaskBarBox taskBarBox1 = new XPTaskBarBox(); taskBarBox1.HeaderForeColor = Color.Yellow; taskBarBox1.HeaderBackColor = Color.FromArgb(17, 158, 218); taskBarBox1.Text = "Header Text"; taskBarBox1.ItemBackColor = Color.White; taskBarBox1.Items.Add(new XPTaskBarItem("Item 1", Color.Black, 0, "Tag1")); taskBarBox1.Items.Add(new XPTaskBarItem("Item 2", Color.Black, 0, "Tag2")); //To set Header fore color for the styles other than default taskBarBox1.UseCustomColors = true; XPTaskBarBox taskBarBox2 = new XPTaskBarBox(); taskBarBox2.HeaderBackColor = Color.FromArgb(17, 158, 218); taskBarBox2.HeaderForeColor = Color.Lime; taskBarBox2.Text = "Another Header Text"; taskBarBox2.ItemBackColor = Color.White; taskBarBox2.Items.Add(new XPTaskBarItem("Item 3", Color.Black, 0, "Tag3")); //To set Header fore color for the styles other than default taskBarBox2.UseCustomColors = true; this.xpTaskBar1.Controls.Add(taskBarBox1); this.xpTaskBar1.Controls.Add(taskBarBox2);
VB
Me.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Metro Dim taskBarBox1 As New XPTaskBarBox() taskBarBox1.HeaderForeColor = Color.Yellow taskBarBox1.HeaderBackColor = Color.FromArgb(17, 158, 218) taskBarBox1.Text = "Header Text" taskBarBox1.ItemBackColor = Color.White taskBarBox1.Items.Add(New XPTaskBarItem("Item 1", Color.Black, 0, "Tag1")) taskBarBox1.Items.Add(New XPTaskBarItem("Item 2", Color.Black, 0, "Tag2")) 'To set Header fore color for the styles other than default taskBarBox1.UseCustomColors = True Dim taskBarBox2 As New XPTaskBarBox() taskBarBox2.HeaderBackColor = Color.FromArgb(17, 158, 218) taskBarBox2.HeaderForeColor = Color.Lime taskBarBox2.Text = "Another Header Text" taskBarBox2.ItemBackColor = Color.White taskBarBox2.Items.Add(New XPTaskBarItem("Item 3", Color.Black, 0, "Tag3")) 'To set Header fore color for the styles other than default taskBarBox2.UseCustomColors = True Me.xpTaskBar1.Controls.Add(taskBarBox1) Me.xpTaskBar1.Controls.Add(taskBarBox2)
Screenshot
Samples:
C#: XPTaskBarSample
VB: XPTaskBarSample