在Silverlight上嘗試一些東西時,我遇到了佈局問題,即它無法像普通網頁一樣根據頁面內容進行擴展。如何根據Silverlight頁面的內容調整layoutRoot的大小?
無論我嘗試什麼,我都無法解決這個問題。 (我試圖打開ScrollBars,分配靜態高度和寬度等)。 我的.xaml文件是在這裏:
<UserControl
x:Class="XXXSL.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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"
d:DesignWidth="640" d:DesignHeight="300">
<Border Style="{StaticResource ContentBorderStyle}">
<Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border x:Name="BrandingBorder" Style="{StaticResource NavBrandingBorderStyle}">
<StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}" >
<ContentControl Style="{StaticResource LogoIcon}" />
<TextBlock x:Name="ApplicationNameTextBlock" Style="{StaticResource ApplicationNameStyle}" Text="Metropoll Emlak Sistemi" />
</StackPanel>
</Border>
<Border x:Name="LinksBorder" Style="{StaticResource NavLinksBorderStyle}">
<StackPanel x:Name="LinksStackPanel" Style="{StaticResource LinksStackPanelStyle}">
<HyperlinkButton Style="{StaticResource LinkStyle}" NavigateUri="Home" TargetName="ContentFrame" Content="..." />
<HyperlinkButton Style="{StaticResource LinkStyle}" NavigateUri="XXX" TargetName="ContentFrame" Content="...." />
<HyperlinkButton Style="{StaticResource LinkStyle}" NavigateUri="YYY" TargetName="ContentFrame" Content="..." />
<HyperlinkButton Style="{StaticResource LinkStyle}" NavigateUri="About" TargetName="ContentFrame" Content="..." />
</StackPanel>
</Border>
<Border x:Name="ContentBorder" Style="{StaticResource NavContentBorderStyle}" Margin="45,-4,0,-38" Grid.Row="2">
<StackPanel Style="{StaticResource LinksStackPanelStyle}">
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource NavContentFrameStyle}" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" UseLayoutRounding="False" />
</StackPanel>
</Border>
</Grid>
</Border>
</UserControl>
任何幫助或建議,可以理解的?
確保在粘貼到StackOverflow時從Xaml中刪除空白行。然後代碼塊將正確顯示。我已經爲你解決了上述問題。 –