Nate Noonen
Nate Noonen

Reputation: 1371

Prism: How to render one view on top of another

We have a Prism/WPF application and are using an expander to animate a menu.

When the expander expands, the content is rendered behind the main region's content.

The menu is in a different region than the content it is supposed to overlay (since the menu governs what items go into that region) which is why this is occurring. We have tried setting the Z-Index of the ContentControls to no avail.

Upvotes: 2

Views: 1300

Answers (2)

Tri Q Tran
Tri Q Tran

Reputation: 5690

Have you tried swapping the order of the ContentControl?

Place your MainContent region ContentControl in the grid first, then your DropdownRegion ContentControl secondly.

<Grid>
    <ContentControl Regions:RegionManager.RegionName="ContentControl" />
    <ContentControl Regions:RegionManager.RegionName="DropdownRegion" />
</Grid>

This is because in XAML, Control placement order dictates rendering order

Upvotes: 2

Anderson Imes
Anderson Imes

Reputation: 25650

If you put two things in the same Grid cell, they overlay. Here's an example where I overlay two images in a grid, but don't specify a cell (meaning column 0, row 0):

<Grid>
     <Image Source="blah.jpg" />
     <Image Source="another.jpg" />
</Grid>

Generally you will want to look more toward layout panels for things like this, rather than traditional Z-Order type of strategies.

Upvotes: 0

Related Questions