How to get a ListBox ItemTemplate to stretch horizontally the full width of the ListBox in Windows 10 universal?


I want to have the ListItems to extend with their Stackpanel the full width of the Listbox.

Currently they are only as wide as the textblocks.

What do I have to do so that the Stackpanel of the ListBoxItems fill the width of the ListBox?

            <ListBox Name="feedListBox" VerticalAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionMode="Single" SelectionChanged="feedListBox_SelectionChanged">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock FontFamily="Segoe UI Symbol" Text="&#x26FD;"  FontSize="25"/>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Name="txtDate" Text="{Binding Date}" FontSize="15" Margin="20,0,0,0"/>
                            <TextBlock Name="txtDitance" Text="{Binding Distance}" FontSize="15" Margin="20,5,0,0"/>
                        <TextBlock Name="txtPrice" Text="{Binding Price}" FontSize="15" Margin="30,0,0,0"/>


delete: VerticalAlignment="Top" and use: HorizontalContentAlignment="Stretch"

This video can help you solving your question :)
By: admin