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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

XPTaskBar dragging

Thread ID:





67748 Aug 29,2007 02:27 PM UTC Sep 25,2007 02:18 PM UTC WinForms 7
Tags: Tools
Joshua Levine
Asked On August 29, 2007 02:27 PM UTC


I'm using an XPTaskBar control with one XPTaskBarBox created in the designer and one or more XPTaskBarBoxes dynamically created.

I'd like to enable dragging (copying) items from the dynamically created XPTaskBarBoxes to the designer created XPTaskBarBox, but prevent drag/dropping within any of the XPTaskBarBoxes (I want them to always remain in the order I specify).

I've tried:

e.Effect = DragDropEffects.None;

in the DragOver, DragDrop, and DragEnter events for the dynamically created XPTaskBarBoxes, and functionally that prevents dropping within the boxes, but the animation still makes it appear that it should work.

Is there a better way to do this? And what about having the default action be a copy rather than a move?

This is for Syncfusion 5.102.1 on .NET 2.0.


J.Nagarajan [Syncfusion]
Replied On September 4, 2007 12:07 AM UTC

Hi Josh,

Thank you for your patience.

To prevent the drag and drop functionality of dynamically created XPTaskBar, you can set AllowDrop property of that XPTaskBar to false. You can set AllowDrop property to true for the XPTaskBarBox created in the designer. Please refer to the following code snippet

//Dynamically created XPTaskBar
Syncfusion.Windows.Forms.Tools.XPTaskBar xptaskBar = new Syncfusion.Windows.Forms.Tools.XPTaskBar();

xptaskbox1 = new XPTaskBarBox();
xptaskbox1.Items.AddRange(new Syncfusion.Windows.Forms.Tools.XPTaskBarItem[] {
new Syncfusion.Windows.Forms.Tools.XPTaskBarItem("One", System.Drawing.Color.Empty, -1, null, null, true, true, "", new System.Drawing.Font("Microsoft Sans Serif", 8.25F), 0),
xptaskbox1.AllowDrop = false;
xptaskbox1.Location = new System.Drawing.Point(0, 0);
xptaskbox1.Size = new System.Drawing.Size(134, 31);
xptaskbox1.Text = "NewxpTaskBarBox1";
xptaskbox1.MouseDown += new MouseEventHandler(xptaskbox1_MouseDown);
xptaskBar.Location = new System.Drawing.Point(130, 130);
xptaskBar.Size = new System.Drawing.Size(120, 300);


void xptaskbox1_MouseDown(object sender, MouseEventArgs e)

string s = xptaskbox1.Items[0].Text;
DragDropEffects dde1 = DoDragDrop(s, DragDropEffects.All);

private void xPTaskBar1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
e.Effect = DragDropEffects.All;

private void xPTaskBar1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
if (e.Data.GetDataPresent(DataFormats.StringFormat))
string str = System.Convert.ToString(e.Data.GetData(DataFormats.StringFormat));
Point pt = xpTaskBarBox3.PointToClient(new Point(e.X, e.Y));
Syncfusion.Windows.Forms.Tools.XPTaskBarItem taskItem = xpTaskBarBox3.HitTest(pt);
taskItem.Text = str;
I have attached the sample that demonstrates this completely. In this sample when you click XPTaskBar->AddTaskBar menuitem, you can create a new task bar. You can download the sample from the following page.


Please refer to the sample and let me know if you have any questions


Joshua Levine
Replied On September 4, 2007 10:58 PM UTC

Hi Neeraj,

Thanks for your reply - that helps (I wasn't quite sure what events I should be using after disabling AllowDrop).

In my code (and in the sample you provided), though, the dynamically created TaskBox no longer collapses. How can I make that continue to work?

Thanks again,

Joshua Levine
Replied On September 4, 2007 11:05 PM UTC

Nagaraj, not Neeraj - thinking one thing, typed another...sorry!


Joshua Levine
Replied On September 5, 2007 09:29 PM UTC

It seems to be handling the MouseDown event that's causing the problem with the menu rolling up. It's also preventing the ItemClick event from working...


Joshua Levine
Replied On September 11, 2007 06:29 PM UTC

Does anyone have any ideas on how to make this work while still allowing the menus to collapse and the ItemClick event to work?

Also, it seems as if Sort() doesn't work on the XPTaskBarBox? Is that by design?


Jeba S [Syncfusion]
Replied On September 18, 2007 01:38 PM UTC

Hi Josh,

We could see the collapse issue in the sample. We are currently working on this and we will update you.

The question you have posted [Sort() for XPTaskBarBox] has raised some very significant issues, as this might be a Feature Request. We will get back to you within 2 business days with a complete response after due analysis of these issues.

Thank you for your patience.

Best Regards,

Jeba S [Syncfusion]
Replied On September 25, 2007 02:18 PM UTC

Hi Josh,

Sorry for the inconvenience caused.

Thank you for opening a Incident 37444.

Please follow up the Incident 37444 for these queries.

Thank you for being patient.

Best Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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