I'd like to be able to drag a row from the UltraGrid to an UltraExplorerBar and have it add an item to the explorer bar, is this possible to do drag and drop between separate controls?
Hi,
It is possible but you have to code the drag operation.
Looks like you will need to handle the SelectionDrag event on the WinGrid and then the DragLeave. Head over to the ExplorerBar and handle the DragEnter/DragOver/DragDrop events and code the parts you are interested in. Remember to set AllowDrop = true for the ExplorerBar. The examples I'm finding seem to always be between two of the same controls (like a tree to a tree) but the concept is the same you just need to provide the logic when moving from one control to other, the API is in place for it to be done.
Some pseudocode to help you get started:
private void ultraGrid2_SelectionDrag(object sender, CancelEventArgs e){ this.ultraGrid2.DoDragDrop(this.ultraGrid2.ActiveRow, DragDropEffects.Copy);}
private void ultraExplorerBar1_DragEnter(object sender, DragEventArgs e){ e.Effect = DragDropEffects.Copy;}
private void ultraExplorerBar1_DragDrop(object sender, DragEventArgs e){ UltraGridRow row = e.Data.GetData(typeof(UltraGridRow)) as UltraGridRow; if (row != null) { string GroupText = row.Cells[0].Text; this.ultraExplorerBar1.Groups.Add(GroupText, GroupText); }}