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

Does GridDataControl support cutomized right click menu?

Thread ID:





95659 Jul 22,2010 08:03 PM UTC Oct 12,2010 10:12 AM UTC WPF 5
Tags: GridControl
Asked On July 22, 2010 08:03 PM UTC

Hi there,

I'm now doing something to bind a datatable to the GridDataControl, and I want to achieve the functionality that when I right click on a certain row of the grid control, a context menu will pop up and the user could select the entries to perform the according actions.

Is it possible to have that customizez context menu and their viewmodel in the grid?

Thank you very much.

Muthulakshmi N [Syncfusion]
Replied On July 23, 2010 11:35 AM UTC


Thank you for your interest in our Syncfusion products.

By listening and handling” PreviewRightMouseButtonDown” event, you can achieve your requirement. Here we have prepared sample which illustrates your request. Please download the sample from the below location.


Let us if you face any issue.


Jimmy Ji
Replied On July 27, 2010 08:58 PM UTC

Thank you for you help.

But it seems that the attached file link is broken, I cannot download the sample from that link.

Could you please fix that? Thank you very much.

Muthulakshmi N [Syncfusion]
Replied On August 2, 2010 01:23 PM UTC


Sorry for the broken link.
Please download the sample from the below link.


Let us know if you need any details.


John Baer
Replied On August 6, 2010 04:11 PM UTC

So I have two follow up questions on this post:

1) In multi-row selection mode, how do we prevent the right-click from changing the visible selection?

2) How do we detect that the right-click occurs only in the data area and not the header row or blank are below the data rows?

In the sample code provided in the post above, the following line of code is provided in an attempt to detect that the proper area has been clicked in. However, this code does not allow for detecting that a header row has been clicked and when clicking in the white space the last data row is used to popualte rci.

RowColumnIndex rci = dataGrid.Model.Grid.PointToCellRowColumnIndex(e.GetPosition(this.dataGrid));

Jeraldes J [Syncfusion]
Replied On October 12, 2010 10:12 AM UTC

Hi John,

Thanks for your patience.

1. We have an issue in this, when the multi selection is done and then by right clicking on the selected are it deselects. For this we request you to post an Incident in the Direct-Trac, we will surly update you with the solution.

2. To check whether the right click is done in the data cell or in the header cell, we have to check with the CellType. Through that the action can be performed.

Please refer the code snippet and sample from the following.

[Code Snippet]
RowColumnIndex rci = dataGrid.Model.Grid.PointToCellRowColumnIndex(e);
if (!rci.IsEmpty && this.dataGrid.Model[rci.RowIndex,rci.ColumnIndex].CellType=="TextBox")

[Sample Link]


Let us know if you need any other details.

Jeraldes J


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

or the page will be automatically redirected to 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