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

How to focus a control loaded inside DataTemplate in GridTemplateColumn?

In SfDataGrid, while using the TemplateColumn, when you enter edit mode using keyboard the focus will be given to the content template by default. This is because, as you can load any control within the DataTemplate, it is not possible to focus on the control loaded within the DataTemplate by default. Hence, you need to set focus to the control loaded inside the DataTemplate explicitly. To set the focus to the controls loaded inside the DataTemplate GridTemplateColumn provides an attached property FocusManagerHelper.FocusedElement. You can get the attached property in Syncfusion.UI.Xaml.Grid namespace.

FocusedElement

The attached property FocusedElement gives focus to a particular UIElement loaded inside the DataTemplate. So it is possible to enter edit mode using keyboard itself as the focus will be given to the loaded UIElement. You can also use the attached property inside the CellTemplate.

The following code example shows, how to set the FocusedElement inside DataTemplate

XAML

 

Sample Links:

WRT

SilverLight

UWP

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
2463 08/06/2014 01/19/2016 Silverlight SfDataGrid 4.5
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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