MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Tabbing into DataGrid firstly focuses each columns SortDirectionIndicator

Open zandervalle opened this issue 6 years ago • 3 comments

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:

Issue Tab to DG

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 👍

zandervalle avatar Jan 09 '20 13:01 zandervalle

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

ahmed-abdelrazek avatar Jan 10 '20 09:01 ahmed-abdelrazek

Thanks man! 👍 that's the behavior I was expecting.

zandervalle avatar Jan 10 '20 10:01 zandervalle

Closing for now. @zandervalle let me know if there is still an issue.

Keboo avatar Jan 10 '20 15:01 Keboo