If there are two prism regions defined in a shell, which one is on top is determined by how these are layed out in the shell one below the other.
<Grid Grid.Row="1" x:Name="_redGrid" >
<ContentControl prism:RegionManager.RegionName="RedRegion" />
</Grid>
<Grid Grid.Row="1" x:Name="_greenGrid">
<ContentControl prism:RegionManager.RegionName="GreenRegion" />
</Grid>
For a simple example, you can take a look at this. It has got a red view and a green view. When you run, it will look like the following.
Is there a way to change this dynamically? Set the zindex of the prism region at run time?
I have extended the above example with a button, objective here is to click the button and change the top to bottom. You can see this example here.
I could do this in the backend file with brute force as follows.
private void btn1_Click(object sender, RoutedEventArgs e)
{
_mainGrid.Children.Remove(_redGrid);
_mainGrid.Children.Remove(_greenGrid);
if (_toggleRegion)
{
_mainGrid.Children.Add(_redGrid);
_mainGrid.Children.Add(_greenGrid);
}
else
{
_mainGrid.Children.Add(_greenGrid);
_mainGrid.Children.Add(_redGrid);
}
_toggleRegion = !_toggleRegion;
}
Click the button, and now the red is on top.
So whats the best way to do this? Is there a feature in Prism which can accomplish this?