Articles in this section
Category / Section

How to focus a control loaded inside DataTemplate in WinRTGrid?

1 min read

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.


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


<syncfusion:GridTemplateColumn MappingName="SalesID">
            <TextBlock Text="{Binding SalesID}"/>
            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <TextBox Text="{Binding SalesID, Mode=TwoWay}"


Sample Links:





Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment