public void SubscribeToDragStart(Action <DragActions> callback) { _grid.MouseDown += (sender, args) => { if (args.Button != MouseButtons.Left) { return; } var index = _grid.HitTest(args.X, args.Y); var rowIndex = index.RowIndex; if (rowIndex == -1) { return; } //var selectedRows = _grid.SelectedRows; DragActions subject; var selectedRows = _grid.SelectedRows.Cast <DataGridViewRow>().ToArray(); if (selectedRows.Select(v => v.Index).Contains(rowIndex)) { // our hit test includes selection. // drag entire selection subject = DragActions.CreateRequest(selectedRows .Select(r => r.DataBoundItem as ActionDisplay) .Select(a => a.Model)); } else { var display = (ActionDisplay)_grid.Rows[index.RowIndex].DataBoundItem; subject = DragActions.CreateRequest(new[] { display.Model }); } callback(subject); DoDragDrop(subject.Request, DragDropEffects.Move); }; }
void StartDrag(DragActions obj) { _bus.Enqueue(new UI.DragStarted(new ActionDragManager(obj.Request, obj.Actions, _bus))); }
public void RegisterDragEvents(DragActions dragAction) { this.dragActions.Add(dragAction); }
public void DeregisterDragEvents(DragActions dragAction) { this.dragActions.Remove(dragAction); }
public extern static void SetDestination(IntPtr widget, DefaultDestination defaultDestination, IntPtr targets, int targetCount, DragActions actions);