Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGrid Sorting by Tap does not always fire #4940

Open
2 of 14 tasks
TorstenKannler opened this issue Oct 10, 2023 · 1 comment
Open
2 of 14 tasks

DataGrid Sorting by Tap does not always fire #4940

TorstenKannler opened this issue Oct 10, 2023 · 1 comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control

Comments

@TorstenKannler
Copy link

Describe the bug

A tap on the column header rarely triggers a dataGrid sorting event.
When you click with the mouse on column header, the event is always triggered immediately, as expected.

Regression

No response

Reproducible in sample app?

  • This bug can be reproduced in the sample app.

Steps to reproduce

To reproduce:

1. Use Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
2. Set DataGrid requirements -> DataGrid.CanUserSortColumns and DataGridColumn.CanUserSort both to true
3. Handle the Sorting event and write a debug message to output window
4. Start the app on a device with a touch screen (e.g. a Surface)
5. Use mouse click on the column headers to get sorting events -> works fine
6. Use tap on the column headers to get sorting event -> only every 2nd or 3rd event will be raised.
   Also change tap between the columns.


I reproduced the behavior in a small UWP App, here is the code:

<!-- MainPage.xaml -->
<Page
    x:Class="DataGridSortingTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DataGridSortingTest"
    xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid>
        <controls:DataGrid  
            x:Name="dataGrid"
            IsTapEnabled="True"
            VerticalAlignment="Stretch" 
            HorizontalAlignment="Stretch"
            HorizontalScrollBarVisibility="Visible"
            VerticalScrollBarVisibility="Visible"
            AreRowDetailsFrozen="True"
            AreRowGroupHeadersFrozen="True"
            AutoGenerateColumns="False"
            CanUserReorderColumns="False"
            CanUserResizeColumns="False"
            ColumnHeaderHeight="80"
            GridLinesVisibility="None"
            HeadersVisibility="Column"
            IsReadOnly="True"
            SelectionMode="Single"
            RowHeight="40"     
            RowDetailsVisibilityMode="Collapsed"

            CanUserSortColumns="True"
            Sorting="dataGrid_Sorting">
            
            <controls:DataGrid.Columns>
                <controls:DataGridTextColumn Header="COL1"
                                                     CanUserSort="True"
                                                     SortDirection="{x:Null}"
                                                     Tag="COL1"
                                                     />
                <controls:DataGridTextColumn Header="COL2"
                                                     CanUserSort="True"
                                                     SortDirection="{x:Null}"
                                                     Tag="COL2"
                                                     />
            </controls:DataGrid.Columns>
        </controls:DataGrid>

    </Grid>
</Page>

// MainPage.xaml.cs
private void dataGrid_Sorting(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridColumnEventArgs e)
{
    System.Diagnostics.Debug.WriteLine("Sort: " + e.Column.Tag.ToString());
}

Expected behavior

The tap action on column header should trigger a sorting event for each tab, just like clicking with the mouse.

Screenshots

By mouse click 5xCOL1 and 5xCOL2

ScreenshotByMouseClick

By tap 5xCOL1 and 5xCOL2

ScreenshotByTap

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

17.6.6

Device form factor

Desktop

Nuget packages

Microsoft.Toolkit.Uwp.UI.Controls 7.1.3

Including the transitive packages:
Microsoft.Toolkit.Uwp.UI.Controls.DataGrid 7.1.3

Additional context

No response

Help us help you

No.

@TorstenKannler TorstenKannler added the bug 🐛 An unexpected issue that highlights incorrect behavior label Oct 10, 2023
@ghost ghost added the needs triage 🔍 label Oct 10, 2023
@ghost
Copy link

ghost commented Oct 10, 2023

Hello TorstenKannler, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@michael-hawker michael-hawker added DataGrid 🔠 Issues on DataGrid control and removed needs triage 🔍 labels Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control
Projects
None yet
Development

No branches or pull requests

2 participants