We're using the grid to layout a navigation bar on top of 75px and a content area below that should take up the rest of the height (we're using the frame navigation approach).
The content section though is being squashed to just short of 100px and the a horizontal scroll bar is added. I've added text wrap, which didn't help. I put a border around the content section and I can see it's not taking up the full space below the nav bar, which should all the screen realestate left.
The code looks as follows:
<UserControl
x:Class="DocRupert.Ui.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
xmlns:login="clr-namespace:DocRupert.Ui.LoginUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition Height="75" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Style="{StaticResource NavigationOuterGridStyle}" Grid.Row="0">
<Border>
<Grid x:Name="NavigationGrid" Style="{StaticResource NavigationGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition Height="35" />
</Grid.RowDefinitions>
<Border x:Name="BrandingBorder" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Style="{StaticResource BrandingBorderStyle}">
<StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}">
<ContentControl Style="{StaticResource LogoIcon}"/>
<TextBlock x:Name="ApplicationNameTextBlock" Style="{StaticResource ApplicationNameStyle}" Text="{Binding Strings.ApplicationName, Source={StaticResource ApplicationResources}}"/>
</StackPanel>
</Border>
<Border x:Name="LinksBorder" Grid.Column="1" Grid.Row="0" Style="{StaticResource LinksBorderStyle}" VerticalAlignment="Top">
<StackPanel x:Name="LinksStackPanel" Style="{StaticResource LinksStackPanelStyle}">
<HyperlinkButton x:Name="MenuHome" Style="{StaticResource LinkStyle}" NavigateUri="/Home" TargetName="ContentFrame" Content="{Binding Path=Strings.HomePageTitle, Source={StaticResource ApplicationResources}}"/>
<Rectangle x:Name="Divider1" Style="{StaticResource DividerStyle}"/>
<HyperlinkButton x:Name="MenuAboutUs" Style="{StaticResource LinkStyle}" NavigateUri="/About" TargetName="ContentFrame" Content="{Binding Path=Strings.AboutPageTitle, Source={StaticResource ApplicationResources}}"/>
</StackPanel>
</Border>
<Border Grid.Column="1" Grid.Row="1">
<StackPanel x:Name="AuthenticationStatusPanel" Style="{StaticResource AuthenticationStatusPanelStyle}">
<login:LoginStatus/>
</StackPanel>
</Border>
</Grid>
</Border>
</Grid>
<Border x:Name="ContentBorder" Grid.Row="1" Style="{StaticResource ContentBorderStyle}" VerticalAlignment="Top">
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" Source="/Home" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
<navigation:Frame.UriMapper>
<uriMapper:UriMapper>
<uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
<uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
</uriMapper:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
</Border>
</Grid>
</UserControl>
[EDIT] - Add Home page XAML Here's the XAML for the home page that is loaded into the frame:
<Grid x:Name="LayoutRoot">
<ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">
<StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">
<TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}"
Text="{Binding Path=Strings.HomePageTitle, Source={StaticResource ApplicationResources}}"/>
<TextBlock TextWrapping="Wrap" Text="Nulla tincidunt, arcu quis ultrices viverra, sapien enim gravida massa, aliquet mollis dolor neque in orci. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent blandit diam quis massa iaculis ut lobortis dui ornare. Morbi pulvinar rutrum justo, ut lacinia elit feugiat bibendum. Duis pharetra dictum mauris sit amet egestas. Suspendisse potenti. Vestibulum posuere velit a enim sollicitudin varius interdum erat scelerisque. Pellentesque blandit felis a diam euismod adipiscing. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum nunc erat; rutrum vel mattis tincidunt, tincidunt id leo. Suspendisse a accumsan urna. Etiam felis nisi, vulputate vel volutpat nec, ultrices nec quam. Maecenas viverra, sapien consequat pharetra vehicula, est erat pretium ipsum, at tempus nunc justo a mauris. Quisque ac auctor eros.
Sed id sollicitudin ligula. Phasellus dictum mauris vel libero imperdiet dictum. Donec bibendum, magna sit amet vestibulum hendrerit, mi turpis tincidunt arcu, eget pellentesque mauris lacus luctus mi. Quisque id justo turpis. Curabitur sollicitudin massa fermentum nunc adipiscing tincidunt vitae non diam. Praesent venenatis aliquet orci sed tincidunt? Etiam tincidunt ligula nec felis dictum condimentum nec egestas urna. Pellentesque blandit diam quis lacus suscipit pharetra. Nunc diam ante, vestibulum ac bibendum venenatis, laoreet blandit eros. Proin eleifend felis velit, a varius leo. Aliquam erat volutpat. Maecenas varius nisl a arcu malesuada convallis. Vestibulum at ipsum turpis, nec pharetra ipsum.
Sed blandit ultrices pulvinar! Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris aliquam scelerisque sem sed tempor. Sed erat risus, tincidunt vitae pellentesque et, semper eu odio! Cras accumsan cursus urna a elementum. Vestibulum quam velit, sollicitudin sed posuere quis, ullamcorper ut purus. Pellentesque sollicitudin nibh vitae d开发者_运维技巧iam elementum eu convallis velit viverra. Maecenas convallis cursus porttitor. Pellentesque purus urna, ultricies sit amet tempor et, hendrerit at sem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc in felis massa, ut congue leo. Maecenas in cursus massa!"></TextBlock>
<TextBlock>hello world</TextBlock>
</StackPanel>
</ScrollViewer>
</Grid>
What GUI elements are you using in your navigation content pages? I would suggest having a Grid as the main GUI element, and ensuring its stretched to take all the available space. To make sure you do this correctly for all of your pages, I would suggest using a style, something like this:
<Style x:Key="NavigationContentGrid" TargetType="Grid">
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
for your navigation root:
<Grid x:Name="LayoutRoot" Style="{StaticResource NavigationContentGrid}">
<ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">
...
</ScrollViewer>
</Grid>
Also, I would suggest that your LayoutRootGridStyle and NavigationOuterGridStyle styles both have these same VerticalAlignment & HorizontalAlignment properties set.
精彩评论