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

handling events for an inactive cell that has a custom control

Hello.
I have a grid that uses a user control to render its cells.
I implemented all the required magic, with a cell model derived from GridGenericControlCellModel and a renderer derived from GridGenericControlCellRenderer.

I can't figure out how to make the cell handle events that don't require the cell to be selected, such as MouseWheel.
When the cell is selected, there is a real control active in it, and it receives the necessary events.
When the cell is not selected, it is just a picture generated internally by the grid using the same instance of my control for all the cells, so there is nobody to received the events.

I think I should handle the events in the renderer (as shown in the Derived Cell Contro Tutorial sample), but I don't know how.
Moreover, there is no OnMouseWheel method that I can override in the renderer, so I'm stuck.

Can you please point me in the right direction?
Thanks.

Regards,
Raul


1 Reply

YV Yuvaraja V Syncfusion Team November 9, 2010 06:13 AM UTC

Hi Raul,
Thank you for using Syncfusion Products.

In Renderer only certain mouse events are to be supported.

In Cell Renderer we can handle the OnMouseWheel() events only in controls.

protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);
Console.WriteLine("OnMouseWheel() is raised");
}

But we can the MouseEvents like

OnMouseDown(int rowIndex, int colIndex, System.Windows.Forms.MouseEventArgs e)
OnMouseUp(int rowIndex, int colIndex, System.Windows.Forms.MouseEventArgs e),
OnMouseHoverEnter(int rowIndex, int colIndex),
OnMouseHoverLeave(int rowIndex, int colIndex, System.EventArgs e),...
are handled without selecting the cell.

For Ex: protected override void OnMouseDown(int rowIndex, int colIndex, System.Windows.Forms.MouseEventArgs e)
{
base.OnMouseDown(rowIndex, colIndex, e);
DrawLink(true, rowIndex, colIndex);
_isMouseDown = true;
}

Here is the link for the sample,

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=CustomControl119885649.zip
Regards,
Yuvaraja V


Loader.
Live Chat Icon For mobile
Up arrow icon