WPF Datagrid -DataGridTemplateColumn tab focus issue WPF Datagrid -DataGridTemplateColumn tab focus issue wpf wpf

WPF Datagrid -DataGridTemplateColumn tab focus issue


We solved this problem by modifying the style on DataGridCell:

<Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">    <Setter Property="IsTabStop" Value="False"/>


I got rid of this problem by handling PrepareCellForEdit event of the grid. Here is the code

void HODataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e){      UIElement inputElement;      ///      /// Texbox is the first control in my template column      ///      inputElement = HODataGridHelper.GetVisualChild<TextBox>(e.EditingElement);      if (inputElement != null)      {           Keyboard.Focus(inputElement);      }}


There is a solution using a static class and one change to the Xaml for the control you want focused. "WPF DataGrid: Tabbing from cell to cell does not set focus on control"