Articles in this section
Category / Section

How to create the WinForms XPTaskBar?

2 mins read

Create the XPTaskBar

You can create an XPTaskBar using the following steps.

1. Through Designer

2. Through Code

Through Designer:

First, make sure you have added the components in the Syncfusion.Tools.Windows assembly to your Toolbox. You can do this by right-clicking on the Toolbox and selecting the components from the above assembly that you find listed under .NET Framework Components. The following dialog window appears.

Choosing the toolbox items

Figure 1: Choosing the Toolbox items


The components of the Syncfusion.Windows.Tools.dll are added in ToolBox, by default.

After choosing the components from the dialog box, the selected components are added to your Toolbox.

XPTaskBar added to the Toolbox

Figure 2: XPTaskBar added to the Toolbox

Once Syncfusion components are added to your Toolbox, you can drag-and-drop the XPTaskBar component onto your form. Then use the XPTaskBar’s smart tag option "Add TaskBarBox" to add XPTaskBarBoxes to the XPTaskBar. You can add one or more items to the boxes through the property browser.

Add XPTaskBar boxes in  XPTaskBar by using smart tag

Figure 3: Add XPTaskBar Boxes in XPTaskBar by using the smart tag

Through Code:

You can create an XPTaskBar by using the following code example.


//To initialize the XPTaskBar
XPTaskBar xpTaskBar1 = new Syncfusion.Windows.Forms.Tools.XPTaskBar();
//To Initialize the XPTaskBarBox
XPTaskBarBox xpTaskBarBox1 = new Syncfusion.Windows.Forms.Tools.XPTaskBarBox();
XPTaskBarBox xpTaskBarBox2 = new Syncfusion.Windows.Forms.Tools.XPTaskBarBox();
this.xpTaskBar1.BorderColor = System.Drawing.Color.Black;
this.xpTaskBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
//To add the XPTaskBarBox to XPTaskBar
this.xpTaskBar1.Dock = System.Windows.Forms.DockStyle.Right;
this.xpTaskBar1.Location = new System.Drawing.Point(237, 0);
this.xpTaskBar1.MinimumSize = new System.Drawing.Size(0, 0);
this.xpTaskBar1.Name = "xpTaskBar1";
this.xpTaskBar1.Size = new System.Drawing.Size(236, 327);
this.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Office2007;
this.xpTaskBar1.TabIndex = 0;
// xpTaskBarBox1
this.xpTaskBarBox1.HeaderForeColor = System.Drawing.Color.White;
this.xpTaskBarBox1.HeaderImageIndex = -1;
this.xpTaskBarBox1.HitTaskBoxArea = false;
this.xpTaskBarBox1.HotTrackColor = System.Drawing.Color.Empty;
this.xpTaskBarBox1.Items.Add(new XPTaskBarItem("Item 1", Color.Black, 0, "Tag1"));
this.xpTaskBarBox1.Items.Add(new XPTaskBarItem("Item 2", Color.Black, 0, "Tag2"));
this.xpTaskBarBox1.Location = new System.Drawing.Point(0, 0);
this.xpTaskBarBox1.Name = "xpTaskBarBox3";
this.xpTaskBarBox1.Size = new System.Drawing.Size(234, 118);
this.xpTaskBarBox1.TabIndex = 0;
this.xpTaskBarBox1.Text = "Tasks";
// xpTaskBarBox2
this.xpTaskBarBox2.HeaderForeColor = System.Drawing.Color.White;
this.xpTaskBarBox2.HeaderImageIndex = -1;
this.xpTaskBarBox2.HitTaskBoxArea = false;
this.xpTaskBarBox2.HotTrackColor = System.Drawing.Color.Empty;
this.xpTaskBarBox2.Items.Add(new XPTaskBarItem("Canada", Color.Black, 0, "Tag1"));
this.xpTaskBarBox2.Items.Add(new XPTaskBarItem("Germani", Color.Black, 0, "Tag2"));
this.xpTaskBarBox2.Items.Add(new XPTaskBarItem("USA", Color.Black, 0, "Tag2"));
this.xpTaskBarBox2.Items.Add(new XPTaskBarItem("UK", Color.Black, 0, "Tag2"));
this.xpTaskBarBox2.Items.Add(new XPTaskBarItem("India", Color.Black, 0, "Tag2"));
this.xpTaskBarBox2.Location = new System.Drawing.Point(0, 119);
this.xpTaskBarBox2.Name = "xpTaskBarBox4";
this.xpTaskBarBox2.Size = new System.Drawing.Size(234, 102);
this.xpTaskBarBox2.TabIndex = 1;
this.xpTaskBarBox2.Text = "Countries";


'To initialize the XPTaskBar
Private xpTaskBar1 As XPTaskBar = New Syncfusion.Windows.Forms.Tools.XPTaskBar()
'To Initialize the XPTaskBarBox
Private xpTaskBarBox1 As XPTaskBarBox = New Syncfusion.Windows.Forms.Tools.XPTaskBarBox()
Private xpTaskBarBox2 As XPTaskBarBox = New Syncfusion.Windows.Forms.Tools.XPTaskBarBox()
Me.xpTaskBar1.BorderColor = System.Drawing.Color.Black
Me.xpTaskBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
'To add the XPTaskBarBox to XPTaskBar
Me.xpTaskBar1.Dock = System.Windows.Forms.DockStyle.Right
Me.xpTaskBar1.Location = New System.Drawing.Point(237, 0)
Me.xpTaskBar1.MinimumSize = New System.Drawing.Size(0, 0)
Me.xpTaskBar1.Name = "xpTaskBar1"
Me.xpTaskBar1.Size = New System.Drawing.Size(236, 327)
Me.xpTaskBar1.Style = Syncfusion.Windows.Forms.Tools.XPTaskBarStyle.Office2007
Me.xpTaskBar1.TabIndex = 0
' xpTaskBarBox1
Me.xpTaskBarBox1.HeaderForeColor = System.Drawing.Color.White
Me.xpTaskBarBox1.HeaderImageIndex = -1
Me.xpTaskBarBox1.HitTaskBoxArea = False
Me.xpTaskBarBox1.HotTrackColor = System.Drawing.Color.Empty
Me.xpTaskBarBox1.Items.Add(New XPTaskBarItem("Item 1", Color.Black, 0, "Tag1"))
Me.xpTaskBarBox1.Items.Add(New XPTaskBarItem("Item 2", Color.Black, 0, "Tag2"))
Me.xpTaskBarBox1.Location = New System.Drawing.Point(0, 0)
Me.xpTaskBarBox1.Name = "xpTaskBarBox3"
Me.xpTaskBarBox1.Size = New System.Drawing.Size(234, 118)
Me.xpTaskBarBox1.TabIndex = 0
Me.xpTaskBarBox1.Text = "Tasks"
' xpTaskBarBox2
Me.xpTaskBarBox2.HeaderForeColor = System.Drawing.Color.White
Me.xpTaskBarBox2.HeaderImageIndex = -1
Me.xpTaskBarBox2.HitTaskBoxArea = False
Me.xpTaskBarBox2.HotTrackColor = System.Drawing.Color.Empty
Me.xpTaskBarBox2.Items.Add(New XPTaskBarItem("Canada", Color.Black, 0, "Tag1"))
Me.xpTaskBarBox2.Items.Add(New XPTaskBarItem("Germani", Color.Black, 0, "Tag2"))
Me.xpTaskBarBox2.Items.Add(New XPTaskBarItem("USA", Color.Black, 0, "Tag2"))
Me.xpTaskBarBox2.Items.Add(New XPTaskBarItem("UK", Color.Black, 0, "Tag2"))
Me.xpTaskBarBox2.Items.Add(New XPTaskBarItem("India", Color.Black, 0, "Tag2"))
Me.xpTaskBarBox2.Location = New System.Drawing.Point(0, 119)
Me.xpTaskBarBox2.Name = "xpTaskBarBox4"
Me.xpTaskBarBox2.Size = New System.Drawing.Size(234, 102)
Me.xpTaskBarBox2.TabIndex = 1
Me.xpTaskBarBox2.Text = "Countries"


XPTaskBar created through designer

Figure 4: XPTaskBar created through designer

XPTaskBar created through code

Figure 5: XPTaskBar created through code


Through Designer:

C#: XPTaskBar_Designer_C#

VB: XPTaskBar_Designer_VB


Through Code:

C#: XPTaskBar_Code_C#

VB: XPTaskBar_Code_VB

Reference link:

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