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

Overriding the Paste event

Thread ID:

Created:

Updated:

Platform:

Replies:

15766 Jun 27,2004 02:16 PM UTC Jun 27,2004 02:55 PM UTC WinForms 1
loading
Tags: GridControl
Lori S. Pearsall
Asked On June 27, 2004 02:16 PM UTC

I''ve overridden the GridStaticCellModel to produce a image cell that displays the image in the grid and also has a dropdown. I''ve overridden the CanCut, Cut, CanCopy & Copy methods to retrieve the image directly from the cell. This works perfectly. I''ve also overridden CanPaste & Paste, but they never get called. I step through the code where the grid.Model.CutPaste.Paste() is invoked but the CanPaste & Paste in the renderer never gets called. I''ve overridden the Paste on a different cell type and it works fine. What do I need to do to get these event handlers to be invoked?

Administrator [Syncfusion]
Replied On June 27, 2004 02:55 PM UTC

The cell renderer Paste/CanPaste events are only raised when the grid has an actively editing CurrentCell. Since a static cell cannot have an ''active'' cell control, these events are not raised and the grid always handles the paste itself at the grid level since there is no cell control that may need to be populated at this point. A couple of things you can try. Both involve handling the grid.Model.ClipboardPaste event in one way or the other. Try handling the event and set e.IgnoreCurrentCell = false. This may allow the renderer events to fire. (It may not depending upon the order that this event is rasied among all its listeners. But is simple to try. The second option is to handle the event and do the calls to these methods yourself.
private void gridControl1_ClipboardPaste(object sender, GridCutPasteEventArgs e)
{
	if(this.gridControl1.Selections.Count == 0)
	{
		GridCellRendererBase cellRenderer = this.gridControl1.Model.CurrentCellRenderer;
		if (cellRenderer != null && cellRenderer.CanPaste() && cellRenderer.Paste())
		{
			e.Handled = true;
		}
	}
}

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

;