多页 WPF 应用程序的最佳方法

发布于 2024-08-27 01:08:13 字数 452 浏览 3 评论 0原文

如何在 WPF 中创建多幻灯片应用程序?最好的方法是什么?我需要的是与下面具有多个页面和导航按钮的选项卡控件非常相似的东西,但我不认为选项卡控件最适合此任务。我希望每个视图都位于单独的 .xaml + 类文件中。而且-当导航到另一个页面时(例如旧页面滑开或类似的东西),有一些动画会很酷。 实现这一目标的最佳技术是什么?


解决方案

实际上,解决方案是使用 MVVM + i 滑动动画,当使用此技术为“活动视图”内容控制更改内容时,通过捕捉瞬间来执行滑动动画 - WPF - 内容更改之前的数据绑定触发

我存储当前内容使用 RenderTargetBitmap 在图像中,并使用简单的动画将图像滑开并将活动内容滑入。

How do I create multislide application in WPF? What is best approach? What I need is something very similar to having tabcontrol with multiple pages and navigation buttons below, but I don't think that tab control is best for this task. I would like to have each view to be in separate .xaml + class file. AND- it would be cool to have some animation, when navigating to another page (like old page slides away or something like that.
What would be best technique to achieve this?


SOLUTION

Solution in deed was to use MVVM + i sliding animation i performed by catching moment, when content get changed for "active view" content control using this technique -
WPF - data binding trigger before content changed

afet that I store current content in image using RenderTargetBitmap and use simple animation to slide Image away and active content in.

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

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

发布评论

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

评论(2

骷髅 2024-09-03 01:08:13

使用带有“下一步”和“后退”按钮的向导样式取得了成功。该设计涉及一个 WPF 视图和一个类似于 ASP.NET 中的母版页的控制 ViewModel。附加到下一个/后退按钮的命令确定将哪些视图/视图模型加载到页面区域中。主视图模型还负责在页面转换期间触发滑动动画。

使用 IOC 容器以解耦的方式加载视图/视图模型效果很好,并且 PRISM 似乎管理各个页面区域的适当工作。

Had success using a wizard style with "Next" and "Back" buttons. The design involved a WPF View and a controlling ViewModel similar to a Masterpage in ASP.NET. The commands attached to the next/back buttons determined which view/viewmodels to load up into the page region. The master viewmodel was also responsible for triggering a sliding animation during a page transition.

Using an IOC container to load up view/viewmodels in a decoupled fashion worked well, and PRISM seemed to to an adequate job managing the various page regions.

南风起 2024-09-03 01:08:13

您是否查看过 WPF 文档中的导航概述?您不喜欢其中描述的工具和技术的哪些方面?

Have you looked at the Navigation Overview in the WPF documentation? What don't you like about the tools and techniques described there?

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