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

How to focus a particular UIElement inside DataTemplate after calling CurrentCell.BeginEdit() or when entering edit mode?

When you use the GridTemplateColumn while entering edit mode, SfDataGrid cannot focus particular UIElement defined inside GridTemplateColumn.EditTemplate. This occurs, as you can load any control within the DataTemplate and it is not possible to focus the control loaded within the DataTemplate by default.

You can set focus to a UIElement inside GridTemplateColumn.EditTemplate by setting FocusManagerHelper.FocusedElement property to true or you can use the FocusManager.FocusedElement to focus the particular UIElement inside DataTemplate.

Consider the following example where you have GridTemplateColumn forCustomerID. When entering into edit mode, TextBox that is defined inside the GridTemplateColumn.EditTemplate is loaded as DataTemplate for the cells of the CustomerID column and TextBox does not get focused. You can set focus to the TextBox when entering edit mode, by setting the attached property “FocusManagerHelper.FocusedElementto Textbox as true.

XAML

Article ID: Published Date: Last Revised Date: Platform: Control:
2527 08/25/2014 01/25/2016 Silverlight SfDataGrid
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