WPF - Why Listbox items do not fill uniformgrid

Malcolm picture Malcolm · Dec 30, 2008 · Viewed 9.4k times · Source

I have a listbox with the ItemsPanelTemplate set to UniformGrid with rows= 6 and cols= 7.

I want the listbox items to fill their space.

I am using a datatemplete defined in a dictionary.

The outer control of my template is a Border with HorizontalAlignment=Stretch and VerticalAlignent=Strectch but the templates do not fill the listbox items space?

Any ideas? Malcolm

Answer

Malcolm picture Malcolm · Jan 3, 2009

The answer to this to set HorizontalContentAligment and VerticalContentAlignment to Stretch on the LISTBOX not the datatemplate.