コード例 #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)));
 }
コード例 #3
0
 public void RegisterDragEvents(DragActions dragAction)
 {
     this.dragActions.Add(dragAction);
 }
コード例 #4
0
 public void DeregisterDragEvents(DragActions dragAction)
 {
     this.dragActions.Remove(dragAction);
 }
コード例 #5
0
ファイル: DragDrop.cs プロジェクト: uriegel/GtkDotNet
 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);
 }