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

GridCurrencyCell and ActivateCurrentCellBehavior (v 2.0)

I created my own GridCurrencyCell, but I''m having trouble with the ActiveCurrentCellBehavior. Attached is a small example, using my CustomCurrencyCell. I want to accomplish the same behavior as in the TextBox cell (1st column) so when the user start typing the cell will enter in Edit Mode (2nd column). TIA Jose. Combo2_7454.zip

2 Replies

AD Administrator Syncfusion Team January 23, 2004 08:44 AM

I think you need to override OnKeyDown in the renderer class and activate the cell there if it is not already active. Below is a try at this.
protected override void OnKeyPress(KeyPressEventArgs e)  
{
	bool controlKeyDown = (Control.ModifierKeys & Keys.Control) != Keys.None;
	bool menuKeyDown = (Control.ModifierKeys & Keys.Alt) != Keys.None;
	if (!e.Handled && !controlKeyDown && !menuKeyDown)
	{
		if (!Char.IsControl(e.KeyChar) 
			&& !IsReadOnly()        // cell is not readonly
			&& SupportsFocusControl)    // OnStartEditing notification returns true
		{
			if (!CurrentCell.HasControlFocus )
			{
				if (this.ValidateString(e.KeyChar.ToString())
					&& CurrentCell.BeginEdit())
				{
					CurrentCell.HasControlFocus = true;
					if (this.NotifyCurrentCellChanging())
					{
						CurrentCell.IsModified = true;
						CurrencyTextBox.Text = e.KeyChar.ToString();
						CurrencyTextBox.SelectionStart = 1;
						CurrencyTextBox.SelectionLength = 0;
					}
				}
				e.Handled = true;
			}
		}
	}
	base.OnKeyPress(e);
}


AD Administrator Syncfusion Team January 23, 2004 10:34 AM

Just what I wanted. Thanks!!!

Loader.
Live Chat Icon For mobile
Up arrow icon