views:

167

answers:

1

I'm trying to convert my VB project to WPF, and one big problem I'm having is what to do about a large GridView that contains in each cell a single image. The grid needs to be very large so is the best way to do this in WPF a datagrid, or a dynamically generated Grid control, or something else? I'm not sure which controls give the best performance as the grid could be 100 x 100 or more.

Any suggestions would be brilliant :o)

+1  A: 

I would try using the WrapPanel, to allow for items to flow nicely. If the images are not of the same size though, you could try the UniformGrid within a ScrollViewer, as it will align items for you uniformly.

Performance wise, I'd say don't optimize prematurely! When you have a nice User Experience, you need to do some reading and decide for yourself. Have a look here.

_NT
Ah thanks for that - I'll have a read through that link. The images are all identical sizes and I'm wanting to place the grid/Wrap panel or whatever into the WPFExtensions ZoomControl after I've got it done. So there's no desperate reason I can't just use normal controls rather than a datagrid in terms of performance?
Becky Franklin
No the WPF controls perform reasonably well so it is not recommended (unless you're showing literally millions of images) to do any optimizations so early on. If the datagrid suits you better, use it, it can certainly hold 10000 images (only a few are shown anyway and WPF can utilize any hardware acceleration available too).
_NT