Do not show partial items in a WPF listbox
- by David Martin
I've tried Google and I've tried Bing to no avail.  Does anyone here have an idea on how to prevent partial items from appearing in a listbox in WPF?  In case that does not make sense here is an example:  Listbox is 200 pixels tall - each item is 35 pixels tall.  That means I can show 5.7 items.  7/10 of an item is undesirable.  I'd like to limit it to showing only 5 items.  The user could then scroll to see the additional items. 
Should I A) try to dynamically size the listbox or ScrollViewer ViewPort so that it fits perfectly?  Or B) implement a custom panel that would not arrange a child whose desired height is more than the remaining vertical space?
Any thoughts would be greatly appreciated.  Last note: If anyone knows of a 3rd party control (listbox or grid) that does this I would be interested in that as well.