【问题标题】:Page Layout in a silverlight Prism projectSilverlight Prism 项目中的页面布局
【发布时间】:2011-08-30 05:24:03
【问题描述】:

好的,我试过问这个问题here,但没有多大成功。尝试了一些技巧,例如this 一个;如果我错了,请纠正我,但我认为这不是最好的方法。

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

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

我的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 中注册的 Modulepage 的 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 的用户控件在哪里,以及其中的内容控件在哪里。我的模块页面也是如此。

再次感谢...

【问题讨论】:

    标签: xaml layout silverlight-4.0 prism


    【解决方案1】:

    从LayoutRoot 中删除VerticalAlignment 和HorizontalAlignment 分配。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-20
      • 1970-01-01
      相关资源
      最近更新 更多