-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
In a WPF application, we are experiencing a significant performance bottleneck when dynamically populating an ItemsControl with a large number of ContentControl elements. The control is configured with a horizontal StackPanel as its ItemsPanelTemplate, and we populate it programmatically using a loop that adds approximately 2000 ContentControl instances. This results in a noticeable delay in UI rendering. The delay scales with the number of items added. We expect the UI to render quickly and the items should be displayed in view once the add button is clicked without delay.
This issue is reproducible in a minimal setup. I have attached a simple sample project for your reference, which demonstrates the rendering delay when dynamically adding a large number of ContentControl elements nearly 2000 to an ItemsControl.
Simple sample - ItemsControl_Sample_WPF.zip
Reproduction Steps
- Run the sample
- Click the Add Items button to add 2000 content control instances
- Observe the delay in UI rendering of the items.
Expected behavior
The UI should render the items quickly, even when adding a large number of lightweight visual elements.
Actual behavior
There is a noticeable delay in rendering 2000 items after the button click. The delay increases with the number of items added.
Delay_In_Displaying_Items_After_Add_Button_Clicked.mp4
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
Other information
No response