L
L
LiptonOlolo2018-07-30 02:42:52
WPF
LiptonOlolo, 2018-07-30 02:42:52

How to draw many items in an ItemsControl?

There are about 500 elements that are stored in the ObservableCollection, but when the desired window is opened, there is a lag for a couple of seconds, after which all elements immediately appear on the form, how to make smooth loading of all elements without form lags?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2018-07-30
@LiptonOlolo

Lag can occur due to several reasons.
The first reason is the long loading or creation of elements. Then, as Mikhail Usotsky writes , you should move the download to another stream.
The second reason is long rendering times in WPF. This is where virtualization can help. If you use ItemsControl, then you should replace it with a ListBox - virtualization does not work in ItemsControl.
If you are using a non-standard ItemsPanel, then you must also use a panel that supports virtualization. In standard WPF, there is only one such - VirtualizingStackPanel, an analogue of StackPanel. You will have to write some others yourself or look for those already written by someone.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question