Tuesday, April 26, 2011

Silverlight: Getting your Listbox Items to stretch

I was having some trouble getting my ListBox items to stretch across the entire ListBox. I did not want to get into the game of dropping into code to fix layout issues. Here is what I had to do.

This first attempt did not work:


I had assumed that the HorizontalContentAlignment attribute would do the trick. For most controls it does. I was wrong. Here is what I finally had to do:



Notice the addition of the container style. As far as I can tell this is a bug. I found the original answer here.

No comments: