在Prism中利用Region的对ContentControl的自动充填问题
在使用Prism的Region进行布局时,我们希望在该Region的内容页,也就是我们的View能自动填充整个Region。一般情况下我们会在ContentControl中将HorizontalAlignment以及VerticalAlignment设置为Stretch,仅仅这样设置还不够,我们还需要对ContentControl中的HorizontalContentAlignment以及VerticalContentAlignment设置为Stretch,否则无法实现整个Region中的View全部填充。如下代码:
<Border BorderBrush="Silver" BorderThickness="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Margin="0" Name="border1" VerticalAlignment="Stretch" Background="#FF4848B9">
<ContentControl Name="contentControl1" prism:RegionManager.RegionName="MainTitleRegion" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</Border>
<ContentControl Name="contentControl1" prism:RegionManager.RegionName="MainTitleRegion" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
</Border>
posted on 2012-02-25 14:40 oldkingsir 阅读(765) 评论(0) 编辑 收藏 举报