dotnet / dotnet/wpf

UI layout update delay when increasing item count (switching from lower to higher counts)

Open
#11,294 0 comments 0 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

When increasing the number of items displayed in a WPF ListBox from a lower count to a higher count, there is a noticeable delay before the UI updates and the layout stabilizes. The control becomes momentarily unresponsive during the transition, and the final layout takes additional time to render. This is especially visible when using grid-like layouts (e.g., WrapPanel or UniformGrid) and higher row/column density.

https://github.com/user-attachments/assets/e0e0f229-8271-4d23-8e56-2d0f4184340b

### Reproduction Steps

1.Run the attached sample application.
2.Click the "Load Items" button to load the initial set of items (count = 50).
Note: The control loads these items in less than a second (time shown in the dialog).
3.Using the ComboBox, select 50 × 50 to load 2,500 items.
4.Observe that the ListBox control takes significantly more time to update the items and render the layout.

The total time taken is approximately 10 seconds, and sometimes it can take up to 20 seconds.

[ListBox_PerformanceIssue.zip](https://github.com/user-attachments/files/23854043/ListBox_PerformanceIssue.zip)

### Expected behavior

We expect the control to take only a few seconds to update the layout, including rendering, even when switching to a higher item count.

### Actual behavior

The control takes around 10 seconds, and sometimes more than 20 seconds, to update the layout and render the items when switching to a higher item count.

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

OS: Windows 11
.NET / .NET Framework: .NET Framework 4.8
UI Framework: WPF

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.