How to stretch ListBox Items horizontally to full width of the ListBox in Xaml ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

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>
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: