Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF ComboBox performance problems by binding a large collections
    primarykey
    data
    text
    <p>I'm trying to bind a large collection to a ComboBox and I faced performance problems when opening ComboBox's popup. I searched internet and found that using VirtualizingStackPanel as a items panel template might help, but it helped only partially. If I bind a large collection to a ComboBox, I could open popup very quickly, that's ok, but if after that I bind another collection to a ComboBox and try to open popup again, it becomes very slow. Same is happening if you open popup for an empty ComboBox, then bind large collection and try to open popup again - it takes some seconds before popup opens.</p> <p>Here is the XAML:</p> <pre><code>&lt;ComboBox Name="cbBlah"&gt; &lt;ComboBox.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;VirtualizingStackPanel /&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ComboBox.ItemsPanel&gt; &lt;/ComboBox&gt; </code></pre> <p>and the sample code for binding to reproduce the problem:</p> <pre><code>var list = new List&lt;string&gt;(); for (var i = 0; i &lt; new Random().Next(9000, 10000); i++) list.Add(i.ToString()); cbBlah.ItemsSource = list; </code></pre> <p>I tried to make virtualizing stack panel to look like this:</p> <pre><code>&lt;VirtualizingStackPanel VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" /&gt; </code></pre> <p>but it doesn't help, seems VirtualizationMode is ignored so popup opens very fast only first time and then, each time after binding changes, it's very slow.</p> <p><strong>UPDATE</strong>: I thought about not binding new collection every time, but bind an ObservableCollection once and then just changing its content. Same thing, as soon as content of collection changes, opening a popup still takes several seconds :(</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload