Articles in this section
Category / Section

How to customize the backcolor of selected item in WinForms XPTaskBar?

1 min read

Customize the backcolor of selected item

SelectedItem backcolor can be customized while applying Office2007 or Office2010 theme to XPTaskBar. It can be achieved by setting the XPTaskBarBoxActiveHighlightedItemColor property from Office2007 or Office2010ColorTable using reflection. The following code demonstrates the same.

C#

//Office2007 Visual Style
this.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Office2007;
var ColorTable = xpTaskBar1.GetType().GetProperty("Office2007ColorTable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
dynamic colortable = ColorTable.GetValue(xpTaskBar1, null);
Office2007Colors Office2007ColorTable = colortable;
 
//Selected XPTaskBarItem BackColor
Office2007ColorTable.XPTaskBarBoxActiveHighlightedItemColor = Color.LightPink;
 
//Office2010 VisualStyle
this.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Office2010;
var ColorTable = xpTaskBar1.GetType().GetProperty("Office2010ColorTable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
dynamic colortable = ColorTable.GetValue(xpTaskBar1, null);
Office2010Colors Office2010ColorTable = colortable;
 
//Selected XPTaskBarItem BackColor
Office2010ColorTable.XPTaskBarBoxActiveHighlightedItemColor = Color.LightPink;

VB

'Office2007 Visual Style
Me.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Office2007
Dim ColorTable = xpTaskBar1.GetType().GetProperty("Office2007ColorTable", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)
Dim colortable_Renamed As Object = ColorTable.GetValue(xpTaskBar1, Nothing)
Dim Office2007ColorTable As Office2007Colors = colortable_Renamed
 
'Selected XPTaskBarItem BackColor
Office2007ColorTable.XPTaskBarBoxActiveHighlightedItemColor = Color. LightPink
 
'Office2010 VisualStyle
Me.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Office2010
Dim ColorTable = xpTaskBar1.GetType().GetProperty("Office2010ColorTable", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)
Dim colortable_Renamed As Object = ColorTable.GetValue(xpTaskBar1, Nothing)
Dim Office2010ColorTable As Office2010Colors = colortable_Renamed
 
'Selected XPTaskBarItem BackColor
Office2010ColorTable.XPTaskBarBoxActiveHighlightedItemColor = Color.LightPink

Screenshot

Customize the backcolor of selected item in Office2007 visualstyle

Figure 1: Selected item background color customized in Office2007VisualStyle XPTaskBar.

Customize the backcolor of selected item in Office2010 visualstyle

Figure 2: Selected item background color customized in Office2010VisualStyle XPTaskBar.

 

Samples:

C#:  XPTaskBarExample

VB: XPTaskBarExample

Reference link: https://help.syncfusion.com/windowsforms/xptaskbar/visual-style

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied