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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Attaching a Context menu when the cell is in Edit mode and Non-edit mode.

Thread ID:

Created:

Updated:

Platform:

Replies:

117903 Jan 7,2015 12:02 PM UTC Jan 8,2015 01:28 PM UTC WinForms 1
loading
Tags: GridGroupingControl
Ranjan
Asked On January 7, 2015 12:02 PM UTC


Hi,


          How to Attach a Context menu when the cell is in Edit Mode and Non-edit mode?



Regards,
Ranjan VijayKumar.

Muthukumar Kalyanasundaram [Syncfusion]
Replied On January 8, 2015 01:28 PM UTC

Hi Ranjan,

 

Thank you for your interest in Syncfusion products.

 

The GridControl is show the context menu, when the right click has been performed in GridControl. The GridControl does not have default property to show the context menu in editing mode. If you want the context menu also in the editing mode, then please try using GridTextBoxRenderer class in GridControl to achieve this behavior.

 

Code:

 

private void Form1_Load(object sender, EventArgs e)
{
this.gridControl1.ContextMenuStrip = this.contextMenuStrip1;
GridTextBoxCellRenderer tr = this.gridControl1.CellRenderers["TextBox"] as GridTextBoxCellRenderer;
tr.TextBox.MouseUp += new MouseEventHandler(TextBox_MouseUp);
}


void TextBox_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
Point pt = GridUtil.CenterPoint(this.gridControl1.CurrentCellRenderer.GetCellClientRectangle(this.gridControl1.CurrentCell.RowIndex, this.gridControl1.CurrentCell.ColIndex, GridStyleInfo.Default, false));
this.contextMenuStrip1.Show(this.gridControl1, pt);
}
}

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: ContextMenu_83095f9c.zip

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.

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

;