Exemplo n.º 1
0
 public BaseGridBehavior()
 {
     this.rowBehaviors       = (IDictionary <System.Type, IGridBehavior>) new Dictionary <System.Type, IGridBehavior>();
     this.scrollReason       = BaseGridBehavior.ScrollReason.MouseWheel;
     this.lockedBehavior     = (IGridBehavior)null;
     this.originalCursor     = (Cursor)null;
     this.scrollBarAtPoint   = (RadScrollBarElement)null;
     this.defaultRowBehavior = new GridRowBehavior();
     this.RegisterBehavior(typeof(GridViewDataRowInfo), (IGridBehavior) new GridDataRowBehavior());
     this.RegisterBehavior(typeof(GridViewNewRowInfo), (IGridBehavior) new GridNewRowBehavior());
     this.RegisterBehavior(typeof(GridViewGroupRowInfo), (IGridBehavior) new GridGroupRowBehavior());
     this.RegisterBehavior(typeof(GridViewFilteringRowInfo), (IGridBehavior) new GridFilterRowBehavior());
     this.RegisterBehavior(typeof(GridViewTableHeaderRowInfo), (IGridBehavior) new GridHeaderRowBehavior());
     this.RegisterBehavior(typeof(GridViewSearchRowInfo), (IGridBehavior) new GridSearchRowBehavior());
     this.RegisterBehavior(typeof(GridViewHierarchyRowInfo), (IGridBehavior) new GridHierarchyRowBehavior());
     this.RegisterBehavior(typeof(GridViewDetailsRowInfo), (IGridBehavior) new GridDetailViewRowBehavior());
     this.scrollTimer          = new Timer();
     this.scrollTimer.Interval = 10;
     this.scrollTimer.Tick    += new EventHandler(this.scrollTimer_Tick);
 }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            bool flag = false;

            if (this.GridControl != null && this.RowInfo != null)
            {
                BaseGridBehavior gridBehavior = this.GridControl.GridBehavior as BaseGridBehavior;
                if (gridBehavior != null)
                {
                    GridRowBehavior behavior = gridBehavior.GetBehavior(this.RowInfo.GetType()) as GridRowBehavior;
                    if (behavior != null)
                    {
                        flag = this.ViewTemplate.AllowRowReorder && behavior.CanResizeRow(e.Location, this.RowElement);
                    }
                }
            }
            if (e.Button != MouseButtons.Left || !this.AllowRowReorder || (!this.ViewTemplate.AllowRowReorder || flag))
            {
                return;
            }
            this.GridViewElement.GetService <RadDragDropService>()?.Start((object)new SnapshotDragItem((RadItem)this.RowElement));
        }