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

Enter cell edit mode in code behind

Thread ID:





103961 Jun 12,2012 06:43 AM UTC Jun 19,2012 07:14 AM UTC Silverlight 1
Tags: GanttControl
Oscar Wahlen
Asked On June 12, 2012 06:43 AM UTC

I have customized a GridTreeColumn by setting the StyleInfo.CellItemTemplate to a custom DataTemplate. But when I hit TAB the cell does not enter cell edit mode. I can see it has focus but I am unable to enter a value unless I double-click first. How can I force the cell to enter edit mode in code behind?

Riyaj Ahamed I [Syncfusion]
Replied On June 19, 2012 07:14 AM UTC

Hi Oscar,


Thanks for your interest in Syncfusion products.


Yes, you can force Data Template cell to enter edit mode while pressing tab key. You can achieve your requirement by using CurrentCellActivated event as follows,


Code Snippet[C#]:


void InternalGrid_CurrentCellActivated(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)


            GridControl control = sender as GridControl;

            if (control != null)


                if (control.CurrentCell.Renderer != null)


                    UIElement element = control.CurrentCell.Renderer.CurrentCellUIElement;

                    if (element != null)


                        TextBox text_box = DependencyObjectExtensions.FindElementOfType<TextBox>(element as FrameworkElement);

                        if (text_box != null)



                            //if it's a TextBox, move caret to the end.

                            if (text_box != null)


                                text_box.SelectionStart = text_box.Text.Length;









We have prepared a sample based on this and you can find the sample under the following location,


Sample: SampleFor103961.zip


Note: In DataTemplate cell you can place any control. But the Grid doesn’t know what kind of control present inside the DataTemplate cell. Hence, when you press the Tab key, the data template cell is not entered to the edit mode. By using the CurrentCellActivated event you can directly force the control placed in cell template to enter edit mode.


Please let us know if you have any queries.



Riyaj Ahamed I



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

or the page will be automatically redirected to 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