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

Custom cell renderer and key events

Thread ID:





47593 Aug 8,2006 07:54 PM UTC Aug 9,2006 10:42 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On August 8, 2006 07:54 PM UTC

I''m building my own cell renderer which hosts a specific type of control. I''ve noticed that if I press enter or the arrow keys while my control has focus, the grid will intercept the key press and do what it would normally do with it and my control never sees those keys. Normal keys work as expected, it''s just special keys like enter, arrows, escape, etc.

What do I have to do in my cell renderer to pass these key events onto my control and not have the grid see and use them.


Administrator [Syncfusion]
Replied On August 9, 2006 10:42 AM UTC

Hi Amit,

Since Grid hosts your control inside the cell, it will use the keys navigation keys to move between the cells and will not pass on to the custom Control. So if the Control (CurrentCell) is in focus, then we need to programmatically do the required functions.

You can try setting the Grid.WantKeys flag to true in the ProcessKeyEventArgs override and revert it back to false in the Keyup event of the custom control, so that the key messages will not be processed by grid.
If you set WantKeys property of the grid to false, the grid will not process any keys like, TAB, arrow keys, Esc, etc.

protected override void OnInitialize(int rowIndex, int colIndex)
this.Control.KeyUp += new KeyEventHandler(Control_KeyUp);

protected override bool ProcessKeyEventArgs(ref System.Windows.Forms.Message m)
Keys keyCode = (Keys) ((int) m.WParam) & Keys.KeyCode;

if (m.Msg == 256 && keyCode == Keys.Tab)
this.Grid.WantKeys = true;
this.Grid.WantKeys = false;

void Control_KeyUp(object sender, KeyEventArgs e)
this.Grid.WantKeys = true;

Let me know if this helps.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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