Handling Region Manager for Multiple Region with same name

Dec 1, 2009 at 2:56 PM
Edited Dec 1, 2009 at 3:36 PM


I am currently working on an Application using CAG with Silverlight on MVVM Pattern, In this we created Shell with Multiple Regions say "Top", "Left", "Right", after loading regions with View

we are opening a Popup which in turn contains 2 more Region as "Top" and "Right", Here i am getting an Exception (System.InvalidOperationException: Element is already child of another element) might be because i need to properly handle my Region Manager for Multiple Region with same name.

Sample Xaml Page Code


<Border Margin="10,5,10,0" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" CornerRadius="0,0,0,0" HorizontalAlignment="Stretch" BorderThickness="0" >  <ItemsControl Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" x:Name="MgrTopRegion" Regions:RegionManager.RegionName="TopRegion" Margin="0,0,0,-200" Background="#FFF4DFDF" HorizontalAlignment="Stretch" Width="AUTO" />

  </Border> <Border Margin="10,5,-5,10" Grid.Row="1" x:Name="LeftRegionBorder" Grid.Column="0" CornerRadius="4,4,0,0" BorderBrush="#B5D9F1" Background="#FFFFFF" BorderThickness="2" VerticalAlignment="Stretch" Height="AUTO" > <ItemsControl Grid.Column="0" Grid.Row="1" x:Name="MgrLeftRegion" Regions:RegionManager.RegionName="LeftRegion" Margin="0,0,0,-200" Background="#FFF4DFDF" VerticalAlignment="Stretch" Height="AUTO" />  </Border>

 <Border Margin="10,5,10,10" Grid.Row="1" Grid.Column="1" CornerRadius="4,4,0,0" BorderBrush="#B5D9F1" Background="#FFF" BorderThickness="2">

 <ItemsControl Grid.Column="1" Grid.Row="1" x:Name="MgrMainRegion" Regions:RegionManager.RegionName="MainRegion" Margin="0,0,0,-200" Background="#FFF" Height="AUTO"/>


Here if i change my Regions:RegionManager.RegionName="MgrMainRegion" everything works well but we need the same reference as from the Shell which is just "LeftRegion","RightRegion", "TopRegion"

Can anybody help me out to handle my Region Manager. Let me know if further clarification needed.