Tabbing into DataGrid firstly focuses each columns SortDirectionIndicator
I'm heading an issue where a DataGrid is part of a data entry form.
Problem
If you want to use keyboard navigation using [TAB] (and [Shift]+[Tab]) to move focus from let's say a TextBox to a DataGrid, you have to press [TAB] n+1 times to get the first cell selected. Where n is number of columns in your DataGrid. WPF alone does not represents this issue.
Expectation
I would expect to get the first cell focused whenever I'm tabbing into the DataGrid. Like default WPF is doing it.
What I have found
In the project linked down, I've selected my TextBox and pressed [TAB] once. Some investigation in Live Visual Tree showed that the "SortDirectionIndicator" of each column gets focused one by one before the first actual datacell gets it:
Environment
- MaterialDesignInXAML:
- MaterialDesignColors 1.2.2
- MaterialDesignThemes 3.0.1
- Win10 1909
- Visual Studio 2019 16.4.2
- .NET Framework 4.7.2
Repo as example
I've comitted a small project to demonstrate the problem https://github.com/zandervalle/DatagridPoc
Thanks
Thank you for this great project. It really helps building some beautiful apps for Windows 👍
you need to stop tab to work for column headers
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
</Style>
i think it's set that way because you can add select all checkbox at a column header
Thanks man! 👍 that's the behavior I was expecting.
Closing for now. @zandervalle let me know if there is still an issue.