如何使ListBox扩展以适应整个可用宽度?

时间:2011-04-25 01:55:23

标签: silverlight xaml windows-phone-7

enter image description here

我需要扩展ListBox以适应它可用的宽度。这是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>

1 个答案:

答案 0 :(得分:2)

请看一下这篇文章 A ListBoxItem that fills its parent