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. Image for the cookie policy date

DragDrop functionality on MainFrameManager

Hi SyncFusion,
I been working with syncfusion now a days. And i required a functionality that if the user drop some thing (lets say a treeview Node) then system should add a button(BarItme) on Toolbar Strip (Bar). while implementing such functionality i found that neither the toolbar (Bar) nor MainFrameBarManager gives me such functionality of Drop event or so. Please do guide me in this regard.

Another thing is that in the same software its like the user have 3 ToolBars (Bar of MainFrameManager ) on the screen and user can add and remove buttons(BarItems) in it, So if any toolbar dont have any buttons it should be removed (invisible lets say) for the user but as soo as the user drop some thing related to that toolbar on the empty area of MainFrameManager the Toolbar should reappear with the desired button added on it.
Can i implement this functionality using SyncFusion.This question may also seems same as asking for Draq and drop functionality on MainFrameManager.

looking forward to your reply.

Regards,
Haroon.


1 Reply

HK Hemaladha K Syncfusion Team September 9, 2008 06:56 AM UTC

Hi Maverick,

Thank you for your interest in Syncfusion Products.

The XPMenus.Bar does not have an AllowDrop property. You could achieve this drag-drop feature by getting hold of the BarControlInternal object and handling its DragEnter and DragDrop events as shown in code below :

[C#]
CommandBarExt cmdbarext = this.mainFrameBarManager1.GetBarControl(this.bar1) as CommandBarExt;
BarControlInternal bcint = cmdbarext.BarControl as BarControlInternal;
bcint.AllowDrop = true;
bcint.DragEnter += new DragEventHandler (CommandBarExt_DragEnter);
bcint.DragDrop += new DragEventHandler (CommandBarExt_DragDrop);

private void CommandBarExt_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
Console.WriteLine ("Bar Drag Enter");

if (e.Data.GetDataPresent(typeof(TreeNodeAdv)))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}

private void CommandBarExt_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
Console.WriteLine ("Bar Drag Drop");

if (e.Data.GetDataPresent(typeof(TreeNodeAdv)))
{
TreeNodeAdv node = e.Data.GetData(typeof(TreeNodeAdv)) as TreeNodeAdv;
BarItem bitem = new BarItem(node.Text);
this.mainFrameBarManager1.Items.Add(bitem);
this.bar1.Items.Add(bitem);
}
}

Please refer to the related KB article below :
How do I perform the drag drop operation between an XPToolBar and TreeViewAdv?
http://www.syncfusion.com/support/kb/tools/Default.aspx?ToDo=view&questId=247

Please refer to the simple sample for your reference and let me know if this helps you.
http://websamples.syncfusion.com/samples/Tools.Windows/F76374/main.htm

Please let me know if you need further assistance.

Regards,
Hema


Loader.
Live Chat Icon For mobile
Up arrow icon