XPTaskBar dragging
Hello,
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.
Thanks,
Josh
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.
Thanks,
Josh
SIGN IN To post a reply.
7 Replies
J.
J.Nagarajan
Syncfusion Team
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);
xptaskBar.Controls.Add(xptaskbox1);
this.Controls.Add(xptaskBar);
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.
http://websamples.syncfusion.com/samples/Tools.Windows/67748/main.htm
Please refer to the sample and let me know if you have any questions
Regards,
Nagaraj
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);
xptaskBar.Controls.Add(xptaskbox1);
this.Controls.Add(xptaskBar);
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.
http://websamples.syncfusion.com/samples/Tools.Windows/67748/main.htm
Please refer to the sample and let me know if you have any questions
Regards,
Nagaraj
JL
Joshua Levine
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,
Josh
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,
Josh
JL
Joshua Levine
September 4, 2007 11:05 PM UTC
Nagaraj, not Neeraj - thinking one thing, typed another...sorry!
--Josh
--Josh
JL
Joshua Levine
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...
--Josh
--Josh
JL
Joshua Levine
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?
--Josh
Also, it seems as if Sort() doesn't work on the XPTaskBarBox? Is that by design?
--Josh
JS
Jeba S
Syncfusion Team
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.
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.
JS
Jeba S
Syncfusion Team
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,
Jeba.
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,
Jeba.
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
JL Joshua Levine
- Aug 29, 2007 02:27 PM UTC
- Sep 25, 2007 02:18 PM UTC