Only Bolivian Here
Only Bolivian Here

Reputation: 36773

How can I make a ListBox expand to fit the entire available width?

enter image description here

I need to make the ListBox expand to fit the width it has available. Here's the XAML:

<ListBox Grid.Row="2" Height="400" ItemsSource="{StaticResource Notes}" VerticalAlignment="Top">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Vertical" Height="90" Margin="5">
                        <TextBlock Text="{Binding Title}" FontSize="30" />
                        <TextBlock Text="{Binding Text}" FontSize="15" />
                        <Rectangle Fill="#1192D4" Height="2" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

Upvotes: 0

Views: 865

Answers (1)

Justin XL
Justin XL

Reputation: 39006

Please take a look at this post A ListBoxItem that fills its parent

Upvotes: 2

Related Questions