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.
Unfortunately, activation email could not send to your email. Please try again.

Disabling grid row deslection from right click

Thread ID:

Created:

Updated:

Platform:

Replies:

79392 Feb 5,2009 01:56 PM Feb 9,2009 07:39 AM Windows Forms 1
loading
Tags: GridControl
Burke Harris
Asked On February 5, 2009 01:56 PM

Is there some way to prevent right clicks from deselecting grid rows like in the thread below?
<http://www.syncfusion.com/support/forums/message.aspx?MessageID=72563>

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




Nisha Arockiya A [Syncfusion]
Replied On February 9, 2009 07:39 AM

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.

Regards,
Nisha.


CONFIRMATION

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.

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.

;