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

Does GridDataControl support cutomized right click menu?

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.

5 Replies

MN Muthulakshmi N Syncfusion Team July 23, 2010 11:35 AM UTC

Hi,

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.

Link:
DataTableDemo.zip

Let us if you face any issue.

Thanks,
Muthulakshmi


JJ Jimmy Ji 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.


MN Muthulakshmi N Syncfusion Team August 2, 2010 01:23 PM UTC

Hi,

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

Link:
http://www.syncfusion.com/uploads/redirect.aspx?file=DataTableDemo_5b51536d_a33a198d.zip&team=development

Let us know if you need any details.

Thanks,
Muthulakshmi.N


JB John Baer 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));


JJ Jeraldes J Syncfusion Team 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]

http://www.syncfusion.com/uploads/redirect.aspx?file=GDC-PreviewMouseDown-95659_2c861cbd.zip&team=development

Let us know if you need any other details.

Regards,
Jeraldes J



Loader.
Live Chat Icon For mobile
Up arrow icon