How to remove Region and add new ContentControls from Module

Posted by Jeaffrey Gilbert on Stack Overflow See other posts from Stack Overflow or by Jeaffrey Gilbert
Published on 2010-06-07T08:38:04Z Indexed on 2010/06/07 8:42 UTC
Read the original article Hit count: 309

Filed under:
|
|
|

I've set only one region in Shell "LoginRegion"

<!-- Login Region -->
<Border Grid.Row="0">
    <ContentControl x:Name="LoginRegion" Regions:RegionManager.RegionName="LoginRegion"
                        VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
</Border>

And after login succeeded, I need to remove "LoginRegion" and add 3 other regions with new LayoutRoot grid definitions to Shell from code behind in Login module.

<Grid.RowDefinitions>
    <RowDefinition Height="93"/>
    <RowDefinition />
    <RowDefinition Height="24"/>
</Grid.RowDefinitions>

<!-- Top Region -->
<Border Grid.Row="0">
    <ContentControl x:Name="TopRegion" Regions:RegionManager.RegionName="TopRegion"
                    VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
</Border>

<!-- Main Region -->
<Border Grid.Row="1">
    <ContentControl x:Name="MainRegion" Regions:RegionManager.RegionName="MainRegion"
                    Style="{StaticResource TestStyle}"
                    VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
</Border>

<!-- Bottom Region -->
<Border Grid.Row="2">
    <ContentControl x:Name="BottomRegion" Regions:RegionManager.RegionName="BottomRegion"
                    VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
</Border>

Please help, thank you.

© Stack Overflow or respective owner

Related posts about c#

Related posts about silverlight-4.0