Danny

Danny

  • 2.1k
  • 5
  • 5.5k

How to stretch ListboxItems in Listbox

Feb 16 2013 1:37 PM
So I have this LISTBOX, which I add items dynamically.

http://www.fileden.com/files/2007/2/5/737151/png2.jpg

As you can see it won't stretch the item to the end of the box. I want the item to stretch and therefore change in size.How can I achieve it? 


This is my XAML:
<ListBox x:Name="CorrWord" Grid.Row="1" Grid.Column="4" Grid.RowSpan="3" BorderBrush="Black" BorderThickness="4" FontFamily="Agency FB" Background="{x:Null}" HorizontalContentAlignment="Stretch"/>


And this is how I add the item with C#:
CorrWord.Items.Add(String.Format("{0}\t\t{1}", word.ToUpper(), word.Length));




HorizontalContentAlignment="Stretch" does not work and I don't know what to use.


Appreciate any help!

Answers (1)