Hi I need a sample code to drag a ultragrid row(s) and drop it in Winforms TreeView.
Thanks
There are no samples of this that I know of. It's really hard to create a sample for this, since there are so many unknown variables here, like is the tree bound? Is the data source the same? Is there a hierarchy?
What part of this is giving you trouble?
I am able to drag the ultragrid row within the ultragrid itself and not able to drag into winforms treeview.
this following code not working.
private void treeView1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent("Infragistics.Win.UltraWinGrid.UltraGrid") == true)
e.Effect =
DragDropEffects.Move | DragDropEffects.Copy;
treeView1.Focus();
}
else
.None;
It's hard to say what wrong with so little information. Drag and drop are essentially implemented on Control. So they work exactly the same for every control. Does the tree have an AllowDrop property on it? Perhaps you need to set that to true.
Why are you calling Focus on the tree? That seems like a bad idea to do inside a DragEnter event.
Also... I could be wrong but I don't think DragEnter is sufficient by itself. You probably need to handle DragOver, as well.