I'm building an SL 4 app. The UI consists of three main parts: a top search bar, a bottom favorite bar, and the page content between the two. I would like the page content to take up all available space. Right now, it expands horizontally but not vertically. I'm not sure what I'm doing wrong. Here is the XAML:
<Grid x:Name="LayoutRoot" Background="BurlyWood">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<my:TopSearchBar x:Name="topSearchBar" Gr开发者_运维百科id.Row="0" Navigator="{Binding ElementName=navigationFrame}" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
<!-- I want this to take up all available space between the bottom and top elements -->
<navigation:Frame x:Name="navigationFrame" Source="/HomePage.xaml" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="BlueViolet" />
<my:BottomFavoritesBar x:Name="bottomFavoritesBar" Grid.Row="2" Navigator="{Binding ElementName=navigationFrame}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
</Grid>
What could I be doing wrong?
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
I can't reproduce your problem. For me, the grid does expand vertically to fill its space, and each of its child controls takes a third of the height.
Do you have this Grid inside something else, like a StackPanel, that would prevent it from filling all the vertical space?
精彩评论