If you want the list items to horizontally stretch to full width of the ListBox in Xaml , you can set the HorizontalContentAlignment property to the value as shown below.
How to stretch ListBox Items horizontally to full width of the ListBox in Xaml ?
Below is a sample code snippet demonstrating the usage of the ItemContainerStyle of the Listbox to set the Style.
<ListBox x:Name="lstACNames"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> </Style> </ListBox.ItemContainerStyle> </ListBox>
Leave a Reply