We wrote a new project using WPF, but after the first few tests I noticed poor performance of ComboBox elements when there are thousands of objects in their datasource. I solved using:
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
I was wondering if the StackPanel control will be prone to this kind of problem with a few hundred custom elements (UserControl with only one label and two buttons). UserControl(s) are added in code in this way in two/tree places in the app:
foreach (var obj in myList)
{
MyUserControl muc = new MyUserControl(obj);
myStackPanel.Add(muc);
}
Can anyone tell me if we will run into problems and/or if there is a way to tell the StackPanel to reuse cached objects?