Region inside the view loading in region

Topics: Prism v4 - Silverlight 4
Aug 3, 2012 at 2:03 AM

Hi Friends out there.

I have a view which i am loading in the region of my shell. Its works fine.But i also need the region within my loaded view .For that i created region inside my view nut when i try to get through region-manger it is unable to find.

So please find how to do this that.

Here is my shell.


    xmlns:toolkit="" xmlns:sdk="" xmlns:ee="" x:Class="NewHappyNagarCompletePrism.HappyNagar"
    d:DesignHeight="626" d:DesignWidth="894">
		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="#FF412541" Offset="0.073"/>
			<GradientStop Color="#FF916969" Offset="1"/>
        <Grid x:Name="LayoutRoot" Height="900" Opacity="0.995" RenderTransformOrigin="0.261,0.243">
        		<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
        			<GradientStop Color="#FF3A3D45" Offset="0.108"/>
        			<GradientStop Color="#FF0E0502"/>
        			<GradientStop Color="Black" Offset="0.927"/>
            <RowDefinition Height="50" />
                <RowDefinition Height="56" />
                <RowDefinition Height="*" />
            <RowDefinition Height="50" />
            <ItemsControl Region:RegionManager.RegionName="MainRegion" VerticalAlignment="Center"  Grid.Row="2"  />
            <ItemsControl Region:RegionManager.RegionName="MenuRegion" VerticalAlignment="Top"  Grid.Row="1"/>
            <TextBlock Margin="416,0,269,12" x:Name="textBlock1"  Foreground="#FF3DAD62" FontFamily="Lucida Bright" FontSize="32" d:LayoutOverrides="Width" >
              		<DropShadowEffect Color="#FF643232"/>
              		<PlaneProjection RotationX="-1"/>

Here is my View which gets loaded in MainRegion.

<UserControl x:Class="ABC.Views.XYZ"
    d:DesignHeight="300" d:DesignWidth="400"
    <Grid x:Name="LayoutRoot" Background="Green" Height="700"  >
            <ColumnDefinition Width="116*" />
            <ColumnDefinition Width="*" />
        <ItemsControl Region:RegionManager.RegionName="ChartDetails" VerticalAlignment="Top" ></ItemsControl>
        <ItemsControl Region:RegionManager.RegionName="MainChart" VerticalAlignment="Top" Grid.Column="1"></ItemsControl>

When i do to get Chartdetails region .Region Manager not able to find it.

 IRegion region = _region.Regions["ChartDetails"];

So please tell me how to do that and what wrong i am doing.

Thanks in advance.

Aug 3, 2012 at 1:35 PM


So far, I couldn't find anything wrong within the code snippets you provided. It would be helpful if you could provide us with more information about your scenario so we can help you further with this. Particularly, it could help us to now, how you are loading your "XYZ" view in your "MainRegion". Also, I believe you could check that the timing when adding each view is in the right order.


Agustin Adami

Aug 4, 2012 at 10:55 AM

Hi Thanks for reply.


In my scenario is that in my view which loads in "MainRegion" will have 2 more region  and in those two region there will be two functionality on that view and

content of these region will be changed.

So for that i need to get these region so that i can load my different view in this nested region.

So please tell me how to do this.

Aug 6, 2012 at 1:43 PM
Edited Aug 6, 2012 at 1:50 PM


Based on my understanding of the scenario you described you should be able to get the nested region without problems. I created a small sample based on the code snippets you provided, in which a view is added to the "ChartDetails" region, perhaps, it could be useful to compare the way you add the views and retrieve the regions, in order to find the cause of your problem.

You can find the sample in my SkyDrive account under the name "NestedRegionSample".

Also, I believe you could check the UI Composition QuickStart provided with Prism, in which nested regions are also used, and it also illustrate how to use both approaches to populate your regions (view discovery and view injection approach).

On the other hand, for more detailed information about the use of regions to dynamically  compose your UI see:

I hope you find this useful,

Agustin Adami