示例#1
0
        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);
            };
        }
示例#2
0
 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);
 }
示例#5
0
 public extern static void SetDestination(IntPtr widget, DefaultDestination defaultDestination, IntPtr targets, int targetCount, DragActions actions);
示例#6
0
 public void DeregisterDragEvents(DragActions dragAction)
 {
     this.dragActions.Remove(dragAction);
 }
示例#7
0
 public void RegisterDragEvents(DragActions dragAction)
 {
     this.dragActions.Add(dragAction);
 }