We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Multiple row selection and right mouse click

With multiple rows selected (via ctrl click or shift click) on a DBDG, if the right mouse button is clicked to launch a popup menu, the selections are lost and the new selection is the cell the user right mouse clicked on. Is there a way (thru code) to keep previous selections active during right mouse clicks? I know if you hold the ctrl or shift key while right mouse clicking, it keeps the selection, but the Windows standard seems to be that you do not have to hold ctrl or shift. I''ve tried to check in the SelectionChanging event, but GridSelectionChangingEventArgs does not indicate mouse attributes.

3 Replies

AD Administrator Syncfusion Team February 8, 2005 11:03 AM

Try setting this property. this.grid.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


RI Rick February 8, 2005 02:36 PM

Fantastic! Ok, here''s one final question. While having multiple rows selected, how do I get the ctrl click to REMOVE a row from the selection (another Windows standard)? Rick


AD Administrator Syncfusion Team February 8, 2005 04:27 PM

Hi Rick, here is some code that should do this: this.gridDataBoundGrid1.GridControlMouseDown += new Syncfusion.Windows.Forms.CancelMouseEventHandler(gridDataBoundGrid1_GridControlMouseDown); private void gridDataBoundGrid1_GridControlMouseDown(object sender, Syncfusion.Windows.Forms.CancelMouseEventArgs e) { int row, col; GridControlBase grid = (GridControlBase) sender; if (grid.PointToRowCol(new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y), out row, out col)) { if (grid.Model.SelectedRanges.GetRangesIntersecting(GridRangeInfo.Row(row)).Count > 0) { grid.Model.Selections.SelectRange(GridRangeInfo.Row(row), false); grid.Model.InvalidateRange(GridRangeInfo.Row(row), GridRangeOptions.None); e.Cancel = true; } } } Stefan >Fantastic! > >Ok, here''s one final question. While having multiple rows selected, how do I get the ctrl click to REMOVE a row from the selection (another Windows standard)? > >Rick

Loader.
Live Chat Icon For mobile
Up arrow icon