好的,我已经尝试过问here,但收效甚微。尝试了一些像this一样的黑客;如果我错了,请纠正我,但我不认为这是最好的方法。
我要做的是让Silverlight应用程序跨越整个浏览器区域。我在上一个问题中提供的解决方案适用于标准的Silverlight项目,但对于Silverlight Prism项目,某些方面似乎不适用相同的规则。我认为这与包含页面的silverlight模块有关,该模块在Shell.xaml的Content控件中加载了主用户控件。
有谁知道如何解决这个问题?
我的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>
我在Shell.xaml的Contentcontrol中注册的Module页面的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>
我使用不同颜色的原因是因为我想看看Shell的用户控件在哪里以及ContentControl中的位置。我的模块页面也是如此。
再次感谢...
答案 0 :(得分:0)
从VerticalAlignment
移除HorizontalAlignment
和LayoutRoot
作业。