)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Platform: WinForms |
Control: XPTaskbar |
Published Date: May 15, 2018 |
Last Revised Date: February 6, 2020 |
.NET Framework: 4

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

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon