2011-05-21 66 views
0

好吧,我试过问这个问题here,但没有太多的成功。尝试了几个黑客,如this一个;纠正我,如果我错了,但我不认为这是最好的方式。Silverlight Prism项目的页面布局

我想要做的是让silverlight应用程序跨越整个浏览器区域。我以前的问题提供的解决方案适用于标准的Silverlight项目,但对于Silverlight Prism项目,似乎不适用相同的规则。我认为这与包含在Shell.xaml的Content控件内加载主要用户控件的页面的silverlight模块有关。

有谁知道如何解决这个问题?

我Shell.xaml下面的代码:

<UserControl x:Class="MyNamspace.Shell" 
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" 
mc:Ignorable="d" 
xmlns:Regions="http://www.codeplex.com/prism" 
Background="#FF2D8543" 
     > 

<ContentControl Regions:RegionManager.RegionName="MainRegion" 
Background="Black" 
VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" 


> 
</ContentControl> 

我Modulepage的,我的Shell.xaml

<UserControl x:Class="MyNamspace.MyClass" 
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" 
mc:Ignorable="d" 
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
MinHeight="800" MinWidth="800" 
> 
<UserControl.Background> 
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
     <GradientStop Color="Black" Offset="0"/> 
     <GradientStop Color="#FF2D8543" Offset="1"/> 
    </LinearGradientBrush> 
</UserControl.Background> 
<Grid x:Name="LayoutRoot" Background="#FFEB0A0A" 
VerticalAlignment="Top" HorizontalAlignment="Center" 
> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="*" /> 
     <ColumnDefinition Width="*" /> 
    </Grid.ColumnDefinitions> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto" /> 
    </Grid.RowDefinitions> 

    <sdk:Label Height="23" HorizontalAlignment="Left" Margin="64,85,0,0" Name="label1" 
    VerticalAlignment="Top" Width="252" Content="Login page here" /> 
</Grid> 

在ContentControl中内登记的XAML

我使用不同颜色的原因是因为我想看看壳牌的u sercontrol是它的内部控件。我的模块页面也一样。再次

谢谢...

回答

0

LayoutRoot删除VerticalAlignmentHorizontalAlignment分配。