Skip to content

When Popup (combobox, tooltip, menu item, etc) is shown within an app with a DataGrid, the DataGrid becomes slow and less responsive. #9881

@brswan

Description

@brswan

Description

When Popup (combobox, tooltip, menu item, etc) is shown within an app with a DataGrid, the DataGrid becomes slow and less responsive. When debugging this problem, we output properties from before and after the popup was shown. It appears the datagrid has several properties that get changed when only a popup is shown. Properties of interest include SizeToContentV, HasStarCellsU, HasGroup3CellsInAutoRows.

Screenshot 2024-10-02 134404

I ran a performance profiler and can see that after the popup is shown the Layout time increases by a major factor as well as the frame rate drops substantially.

Screenshot 2024-10-02 142645

I have tried to fix the datagrid column width and row height to no avail. I have also overridden the cell template with fixed size values and this did not work either.

datagrid-02

DataGridTest.zip

Reproduction Steps

  • Create an app with a combobox and datagrid (see attachment).
  • Run the app and vertically scroll. Scrolling will be smooth without lag.
  • Open the combobox to show the items panel. You do not need to select an item - the panel just needs to be shown
  • Close combobox panel
  • Vertically scroll the datagrid and you will see lag (it may be slight lag but it is an indicator of the problem)

Apps with more complex UIs will display this issue more apparently.

Included app has a button Export that will export all properties of the app. You can export before following the steps above. Then export again once slowness occurs and you will see properties are changed from before and after combobox items are displayed. Please see screen shot from Description for comparison.

Expected behavior

Datagrid should behave the same way before a Popup (combobox, tooltip, menu item, etc) is shown and after.

Actual behavior

Datagrid is responsive before a Popup (combobox, tooltip, menu item, etc) is shown. After the popup is shown, datagrid slows.

Regression?

Problem exists in NET6 and NET8

Known Workarounds

None at this time

Impact

Datagrid in the app becomes slow and sluggish to use. Our app is a real-time app that requires the datagrid to be responsive to user input.

Configuration

Windows 11 Pro 23H2 OS Build 22631.4169
Visual Studio 2022 Version 17.9.6
x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    InvestigateRequires further investigation by the WPF team.PerformancePerformance related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions