在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>
原文地址:https://www.cnblogs.com/oldkingsir/p/2367768.html