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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disabling grid row deslection from right click

Thread ID:





79392 Feb 5,2009 06:56 PM UTC Feb 9,2009 12:39 PM UTC WinForms 1
Tags: GridControl
Burke Harris
Asked On February 5, 2009 06:56 PM UTC

Is there some way to prevent right clicks from deselecting grid rows like in the thread below?

We are using v and SelectCellsMouseButtonsMask does not seem to be available.

Nisha Arockiya A [Syncfusion]
Replied On February 9, 2009 12:39 PM UTC

Hi Burkeharris,

Thanks for your intrest in Syncfusion Products.

The SelectionsChanging event is being hit before the mousedown event. If you want to control which is being hit first, then I think youwould have to derive the grid and over the virtuals OnSelectionChanging and OnMouseDown instead of using events.If you want to use events, then this SelectionChanging handler made it so that a right-click on selected cells does not unselect anything.
private void SelectionChanging(object sender, GridSelectionChangingEventArgs e)
if (e.Reason == GridSelectionReason.MouseDown & Control.MouseButtons == MouseButtons.Right)
int row = 0;
int col = 0;
Point pt = this.GridDataBoundGrid1.PointToClient(Control.MousePosition);
if (this.GridDataBoundGrid1.PointToRowCol(pt, row, col, -1))
GridRangeInfoList rangeList = null;
rangeList = this.GridDataBoundGrid1.Selections.GetSelectedRows(true, false);
if (rangeList.AnyRangeIntersects(GridRangeInfo.Cell(row, col)))
e.Cancel = true;

Let me know if this helps.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon