void _superList_DragDropEx(object sender, SuperlistDragEventArgs ea) { bool changed = false; GroupSection gs = ea.SectionOver as GroupSection; if (gs != null) { IDataObject dataObject = ea.DragEventArgs.Data; string[] formats = dataObject.GetFormats(); foreach (string format in formats) { object[] items = dataObject.GetData(format) as object[]; foreach (object item in items) { RowIdentifier ri = item as RowIdentifier; if (ri != null) { foreach (Person p in ri.Items) { ApplyDragDropChanges(gs.RowIdentifier.GroupColumns, (Person)gs.RowIdentifier.Items[0], p); changed = true; } } } } } if (changed) { _superList.Items.Sort(); } }
void _superList_DragOver(object sender, SuperlistDragEventArgs e) { // // In this example we're interested if the section over has a grouped section // for an ancestor. If it does then we allow dropping on the section GroupSection gs = e.SectionOver.GetAncestor <GroupSection>(true); if (gs != null) { e.SectionAllowedToDropOn = gs; return; } e.DragEventArgs.Effect = DragDropEffects.None; }
void _listControl_DragOverEx(object sender, SuperlistDragEventArgs ea) { ListControl senderControl = sender as ListControl; if (senderControl != null) { Person[] items = PersonsFromDataObject(ea.DragEventArgs.Data); foreach (Person p in items) { if (senderControl.Items.IndexOf(p) != -1) { return; // don't allow items to be dropped on ourself. } } ea.SectionAllowedToDropOn = ea.SectionOver; return; } ea.DragEventArgs.Effect = DragDropEffects.None; }
void _listControl_DragDropEx(object sender, SuperlistDragEventArgs ea) { ListControl senderControl = sender as ListControl; if (senderControl != null) { Person[] persons = PersonsFromDataObject(ea.DragEventArgs.Data); if (sender == _listControl1) // we remove the persons from the other list in this example and add to the sender { _listControl2.Items.RemoveRange(persons); } else { _listControl1.Items.RemoveRange(persons); } senderControl.Items.AddRange(persons); } }