Center listbox items vertically?

Jul 29, 2010 at 7:53 AM

I have a listbox for the main menu in my app (same as the test app I guess).

On my VGA device it just so happens that I have the right amount of items for it to fit neatly on the screen without needing to be scrolled. One of my testers however has a WVGA device, so the items start at the top and then there is a big gap at the bottom. 

Is there a simple way to center everything so it looks a little nicer? Another idea I thought of was to divide the screenheight by the number of items I have, and use this as the item height but then I think in landscape mode (or low resolution devices) text might overlap as the items get too small... I could put in another check for that and leave the items at default height of course. But if there was a quick way it would be useful...

As an aside, my testers are liking the new interface a lot; most of which is down to Silvermoon of course, so the work you've done is fantastic!

Aug 15, 2010 at 10:37 PM

The new ListView control (which is the successor of ListBox) has a VirtualHeightChanged event, which can be used for that case.