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.


Are you a .NET Developer planning to integrate GraphQL for .NET in your Application? Check out this book
<ListBox x:Name="lstACNames">
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
            </Style>
        </ListBox.ItemContainerStyle>
</ListBox>
%d bloggers like this: