Question

I heard that in order to improve Listbox performance, we should use simple ListBoxItem template.

In every Listbox row, I want to display 3 images. Should I use horizontal StackPanel for those 3 images, or Grid with 3 columns ?

And, should I specify the height of StackPanel/Grid ? Doing this gains better performance ?

Was it helpful?

Solution

While making a Listbox, the best practice is to use a StackPanel. The basic difference between a StackPanel and Grid is that, the StackPanel will automatically adjust the Orientation of each ItemTemplate as and when it is added.

If you decide to use a StackPanel, you do not need to specify the Width. You could However specify the Maximum Height of the Stack Panel to make your ListBox look better.

There is no harm in using a Grid either. It would perhaps be a better idea to use a Grid if you wish to have columns of Alpha-Numeric Data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top