Tergiver

The MSDN Library document:
ms-help://MS.VSCC.v90/MS.MSDN.v90/MS.NETDEVFX.v35.en/wpf_conceptual/html/4701fe4a-4ad6-48ab-94da-423492e67d5a.htm

Is no help, it's wrong. If you set a listbox item's width to auto it will resize to its content and ignore the HorizontalAlignment=Stretch property.

If you set the listbox item's width to be bound to the listbox's ActualWidth it appears to work. That is, until the vertical scroll bar appears.

Is there a way to make the items in the list box have a width that is as wide as the list box, minus the vertical scroll bar if and only if it is visible.



Re: Windows Presentation Foundation (WPF) How to: Size a ListBoxItem to Fill the ListBox

Josh Smith

On the ListBox set

HorizontalContentAlignment="Stretch"






Re: Windows Presentation Foundation (WPF) How to: Size a ListBoxItem to Fill the ListBox

Tergiver

Thank you!