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

contextmenu for editable cells

When I create columns that are editable using GridDataVisibleColumn with ReadOnly = false,
the menu that appears for cells in that column is copy,paste,cut.
I would like to add another menuitem.
I tried doing this by setting a GridDataControl.ContextMenu.
But this menu only appears for the read-only cells.

How do I add custom menu items to the default menu for textbox cells that are editable?

Thanks.


9 Replies

RV Ramesh V Syncfusion Team July 11, 2011 11:39 AM UTC

Hi Mary,

Thanks for using Syncfusion products.
By Default we cannot include Items into Default ContextMenu. But we can create our own context menu. We have prepared a sample based on this you can find the sample under the following location.

Sample: http://www.syncfusion.com/uploads/redirect.aspx?file=ContextMenu_Sample-_e4bff4c6.rar&team=testingftp

Please let me know if you need further assistants.

Regards,
Ramesh



MF Mary Fontana July 22, 2011 01:57 PM UTC

Hi. The link you posted does not exist.



DM Deenadhayalan M Syncfusion Team July 26, 2011 12:34 PM UTC

Hi Mary,

Please find the below link for the sample.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDCSample1258500571.zip

Please let us know if you have any queries.

Thanks,
Deenadhayalan



GDCSample1258500571_ff03acad.zip


MF Mary Fontana July 26, 2011 04:54 PM UTC

Your sample does not work for me I think because I use GridDataVisibleColumn to add the columns.

Your example sets gridControl's ContextMenu

dataGridControl.ContextMenu = menu;

I already had the context menu set.

But when you use GridDataVisibleColumn that uses a TextBox,
the menu used is not the one in dataGridControl.

Please see my attached sample. I added event to handle PreviewMouseRightButtonDown



WPF_GDC_CheckBox_41be6e49.zip


MF Mary Fontana July 26, 2011 07:34 PM UTC

Please ignore my previous post. I finally got this working by setting the
ColumnStyle = new GridDataColumnStyle() for each GridDataVisibleColumn.

Thanks for your sample.

Mary



MF Mary Fontana July 26, 2011 08:23 PM UTC

Sorry,

It still doesnt work. I will see the new context menu in a textbox, but only if I dont select the text box for editing.
and then it uses the copy/paste/cut menu





WPF_GDC_CheckBox_66106f95.zip


DM Deenadhayalan M Syncfusion Team July 29, 2011 03:49 PM UTC

Hi Mary,

Sorry for the inconvenience caused.

We have modified the sample based on your requirement with cut, copy, paste, undo items in the context menu. Please find the attached sample for your reference.

Please let us know if you have any queries.

Regards,
Deenadhayalan




WPF_GDC_CheckBox_acdbcddd.zip


MF Mary Fontana July 29, 2011 06:38 PM UTC

Hi. Thanks for the update.

I only see the new menu items "cut/copy/paste/undo on the column headers when I right click mouse.
The cells that can be edited still have the copy/cut/paste menu which I think is from the Textbox.
So like if I select Sync1 and then right click I still see the menu copy/cut/paste.

Is there cell type other then textbox that I should use so that the menu is not is not set.

For Now I have implemented a button to do the extra feature on the selected item.



DM Deenadhayalan M Syncfusion Team August 2, 2011 02:37 PM UTC

Hi Mary,

Sorry for the inconvenience caused.

You can achieve your requirement by setting the DisableEditorsContextMenu property to true as follows, This property will disable the editors context menu.

Code snippet [C#]:

this.gdc.Model.DisableEditorsContextMenu = true;

Please let us know if you have any queries.

Regards,
Deenadhayalan


Loader.
Live Chat Icon For mobile
Up arrow icon