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
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.
© 2024 OneMinuteCode. All rights reserved.