WPF is unusually slow to use TextBox in bulk

Asked 2 years ago, Updated 2 years ago, 119 views

If you want to be faster, you shouldn't use TextBox.
Please let me know if there is any way to make it faster using TextBox.

c# wpf

2022-09-30 18:50

1 Answers

The design of 7000 TextBox displayed at the same time is not practical (if so, you should reconsider it), so in common sense, only a small fraction of them are actually displayed on the screen by some kind of scrolling.
For such a design, UI virtualization can reduce the load.In a nutshell, the method is not to actually create elements that are not displayed.
If ItemsSource is specified, ListView and DataGrid have virtualization enabled by default, but

for ItemsControl
<ItemsControl
    VirtualizingPanel.IsVirtualizing="True">
    </ItemsControl.ItemsHost>
        <VirtualizingStackPanel/>
    <ItemsControl.ItemsHost>
</ItemsControl>

and VirtualizingStackPanel for virtualization.If you are using a layout other than StackPanel, you do not have a built-in VirtualizingPanel, so you must make your own.

It is recommended that you analyze it with a profiler once, as it may actually be due to non-UI reasons.


2022-09-30 18:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.