使用Silverlight导航项目模板,我希望我的页面内容在导航框架中水平且道德地居中,而不是填满整个空间。
例如,考虑这段xaml-placed home.xmal视图。其结果是一个圆角米色背景,在整个框架中间适当地填充了“一些有趣的内容”。
<navigation:Page x:Class="SilverlightApplication3.Home"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
Title="Home"
Style="{StaticResource PageStyle}">
<Grid x:Name="LayoutRoot">
<Border BorderThickness="5" CornerRadius="20" Background="Beige" Width="Auto" Height="Auto">
<TextBlock Text="Some interesting content goes here" FontSize="20"
FontFamily="Comic Sans MS" Foreground="Teal"
HorizontalAlignment="Center"
VerticalAlignment="Center" Margin="20"/>
</Border>
</Grid>
</navigation:Page>
我所希望的是,文本将被米色背景包围,背景距内容20像素。
现在如果我加上这个布局根
Width="400" Height="100"
然后我得到一些看起来很接近的东西,不管这些数字是固定的,都不适合随着内容大小的变化。
如何更改主页视图或主页框架的XAML以实现所需的布局?