Prism:如何将一个视图渲染在另一个视图之上

发布于 2024-09-02 22:00:31 字数 172 浏览 2 评论 0原文

我们有一个 Prism/WPF 应用程序,并使用扩展器来制作菜单动画。

当扩展器展开时,内容将呈现在主区域内容的后面。

菜单位于与它应该覆盖的内容不同的区域中(因为菜单控制哪些项目进入该区域),这就是发生这种情况的原因。我们尝试设置 ContentControls 的 Z-Index,但没有成功。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦晓ヶ微光ヅ倾城 2024-09-09 22:00:31

您是否尝试过交换 ContentControl 的顺序?

首先将您的 MainContent 区域 ContentControl 放置在网格中,然后将您的 DropdownRegion ContentControl 放置在网格中。

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

这是因为在 XAML 中,控件放置顺序决定了渲染顺序

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

遮云壑 2024-09-09 22:00:31

如果将两个东西放在同一个网格单元格中,它们就会重叠。下面是我在网格中叠加两个图像的示例,但不指定单元格(即第 0 列、第 0 行):

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

通常,您会希望更多地关注此类内容的布局面板,而不是传统的 Z 顺序类型策略。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文