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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disabling grid row deslection from right click

Thread ID:

Created:

Updated:

Platform:

Replies:

79392 Feb 5,2009 06:56 PM UTC Feb 9,2009 12:39 PM UTC WinForms 1
loading
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?
<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 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.

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.

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

;