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.
Unfortunately, activation email could not send to your email. Please try again.

contextmenu for editable cells

Thread ID:

Created:

Updated:

Platform:

Replies:

100089 Jul 2,2011 08:06 PM Aug 2,2011 10:37 AM WPF 9
loading
Tags: GridControl
Mary Fontana
Asked On July 2, 2011 08:06 PM

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.


Ramesh V [Syncfusion]
Replied On July 11, 2011 07:39 AM

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


Mary Fontana
Replied On July 22, 2011 09:57 AM

Hi. The link you posted does not exist.


Deenadhayalan M [Syncfusion]
Replied On July 26, 2011 08:34 AM

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

Mary Fontana
Replied On July 26, 2011 12:54 PM

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

Mary Fontana
Replied On July 26, 2011 03:34 PM

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

Thanks for your sample.

Mary


Mary Fontana
Replied On July 26, 2011 04:23 PM

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

Deenadhayalan M [Syncfusion]
Replied On July 29, 2011 11:49 AM

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

Mary Fontana
Replied On July 29, 2011 02:38 PM

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.


Deenadhayalan M [Syncfusion]
Replied On August 2, 2011 10:37 AM

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


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.

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.

;