niewolny.info … yet another .net blog.

29Nov/140

ListBox using WrapPanel with VerticalScrollBar

Recently I was using a ListBox in Silverlight together with the WrapPanel. Idea wasn't too complicated, just a list and a button to add items. Each time the button was pressed, some items was generated in code behind and added to the list. If there was no space left for the new item, the wrap panel was expected to do his job, wrap the line and vertical scroll-bar was expected to be showed. So far so good... but it was not working as expected.
So the code was looking more less like this one: