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
close icon

Lost selection on RightMouse-Click

Hi there,

how can I prevent my selection for unselection when clicking the right mouse button?

I'm calling with the right mouse button a context menu, e.g. to copy the selected cells. But when clicking the right mouse button my selection is gone.

Do you have any suggestions?

Greetings
Andreas


1 Reply

MK Mayavel K Syncfusion Team March 22, 2011 05:50 AM UTC

Hi Andreas,

Thank you for using Syncfusion products.

The mouse right click event can be prevented from changing the selected item as follows. This will retains the previous selected item when left button is clicked.

[Code Snippet] [C#]

void dataGrid_ModelLoaded(object sender, EventArgs e)
{
this.dataGrid.PreviewMouseRightButtonDown += new MouseButtonEventHandler(dataGrid_PreviewMouseRightButtonDown);
}

void dataGrid_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{

// Any process can be implemented here

e.Handled = true;
}

Please find the attached sample for your reference.

Thanks
Mayavel K



MouseRightClick_Sample-1325868245_94e3277c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon