In SfDataGrid, while using the TemplateColumn you cannot handle key navigation, mouse interaction and focusing for controls loaded within DataTemplate 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, GridTemplateColumn provides the list of to handle key navigation, mouse interaction, focusing for loaded controls within DataTemplate. You can get the following attached properties in Syncfusion.UI.Xaml.Grid namespace.
Thus, in order to enter edit mode using keyboard you need to set focus to the control loaded inside the DataTemplate explicitly. To set the focus to the control loaded inside the DataTemplate you can use the attached property, FocusedElement.
The attached property FocusedElement gives focus to particular UIElement loaded inside the DataTemplate. So, you can enter edit mode using keyboard itself.
The following code sample shows, how to set the FocusedElement inside DataTemplate
The attached property allows the controls loaded in CellTemplate to handle key navigation within it or by Grid. When you set it to ‘false’, you cannot navigate using keys within the loaded control.
Note: Enter and Tab keys are always handled by Grid only.
The following code sample explains you about WantsKeyInput.
The attached property allows the controls loaded in CellTemplate to handle mouse interaction within it or by Grid.
The following code example explains you about WantsMouseInput
In addition to the above attached properties, you can set focused element by using FocusManager. FocusedElement attached property which comes in WPF framework can be used only for EditTemplate and not for editing inside the CellTemplate.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:|
or the page will be automatically redirected to sign-in page in 10 seconds.