Beispiel #1
0
 protected override void OnMouseMove(UIMouseEventArgs e)
 {
     if (e.IsDragging)
     {
         GridLayer layer   = _gridViewRenderE.GridLayer;
         GridCell  hitCell = layer.GetGridItemByPosition(e.X, e.Y);
         if (_gridSelectionSession != null)
         {
             _gridSelectionSession.SetLatestHit(hitCell);
         }
     }
     base.OnMouseMove(e);
 }
Beispiel #2
0
        protected override void OnMouseDown(UIMouseEventArgs e)
        {
            //check if cell content
            //find grid item
            GridLayer layer   = _gridViewRenderE.GridLayer;
            GridCell  hitCell = layer.GetGridItemByPosition(e.X, e.Y);

            if (hitCell != null)
            {
                var box = hitCell.ContentElement as RenderBoxBase;
                if (box != null)
                {
                    if (box.ContainPoint(e.X - hitCell.X, e.Y - hitCell.Y))
                    {
                        IUIEventListener evenListener = box.GetController() as IUIEventListener;
                        if (evenListener != null)
                        {
                            int tmpX = e.X;
                            int tmpY = e.Y;
                            e.SetLocation(tmpX - hitCell.X, tmpY - hitCell.Y);
                            evenListener.ListenMouseDown(e);
                            e.SetLocation(tmpX, tmpY);
                        }
                    }
                }
                //
                //move _dragController to the selected cell?
                //
                if (EnableGridCellSelection)
                {
                    //--------
                    if (_gridSelectionSession == null)
                    {
                        _gridSelectionSession = new GridSelectionSession();
                        _gridSelectionSession.SetTargetGridView(this);
                    }
                    _gridSelectionSession.StartAt(hitCell);
                }
            }

            base.OnMouseDown(e);
        }