C# WPF 中的页面、框架、导航窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13950833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Page, Frame, Navigation windows in C# WPF
提问by Hatem
- I would like to know the difference between page, frame, navigation windows in c# wpf
- what is the best choice of them for wpf windows application?
- in my application how to make fixed part (contain main buttons) and changeable part (show pages) after clicking buttons in fixed part
- are there any good websites provides video tutorials for c# wpf from beginning to professional?
- 我想知道 c# wpf 中页面、框架、导航窗口之间的区别
- wpf windows应用程序的最佳选择是什么?
- 在我的应用程序中,单击固定部分中的按钮后如何制作固定部分(包含主要按钮)和可变部分(显示页面)
- 有没有好的网站提供c# wpf从入门到专业的视频教程?
thank you
谢谢你
采纳答案by Thorsten Dittmar
A Pageis much like a user control, only that is is displayed within a Frame, which again is part of a NavigationWindow. A NavigationWindowis a special kind of window that allows for page navigation and can display the respective controls for navigating pages.
APage很像用户控件,只是它显示在 a 中Frame,而后者又是 a 的一部分NavigationWindow。ANavigationWindow是一种特殊的窗口,允许进行页面导航,并可以显示用于导航页面的相应控件。
A paged application is a good choice if you want Wizard-like functionality, or if the user experience should be comparable to what you get when browsing the web. In many cases, using standard WPF windows is a better choice.
如果您想要类似向导的功能,或者如果用户体验应该与浏览 Web 时获得的体验相当,分页应用程序是一个不错的选择。在许多情况下,使用标准 WPF 窗口是更好的选择。
The NavigationWindowalready contains a "fixed part" that can contain controls. You can also use a normal window, place a Framein it and then - through proper layout - create your own "fixed parts". Navigation would then come down to calling the navigation methods the Frameprovides.
在NavigationWindow已经包含“固定部分”,它可以包含控件。您也可以使用普通窗口,Frame在其中放置一个,然后通过适当的布局创建您自己的“固定部分”。然后导航将归结为调用Frame提供的导航方法。
回答by khellang
From the answer to this question:
从这个问题的答案:
Pages are intended for use in navigation applications (usually with back and forward buttons, e.g. Internet Explorer). Pages must be hosted in a
NavigationWindowor aFrame
页面旨在用于导航应用程序(通常带有后退和前进按钮,例如 Internet Explorer)。页面必须托管在一个
NavigationWindow或一个Frame
The best choice depends on what kind of application you want to create. Is it a wizard or navigation type application or just a regular application with one window (maybe with tabs)?
最佳选择取决于您要创建的应用程序类型。它是一个向导或导航类型的应用程序,还是只是一个带有一个窗口(可能带有选项卡)的常规应用程序?
I would definitely consider using a MVVM framework like Caliburn.Microfor making a WPF application. It has some really powerful mechanisms for dealing with Screens, Conductors and Composition, in addition to encouraging you to decouple your application by using the MVVM pattern. The author of Caliburn.Micro, Rob Eisenberg, has written some tutorials with extensive explanation about and how to use the framework under the project's documentation. There is also lots of resources around the interwebz, google it! :)
我肯定会考虑使用像Caliburn.Micro这样的 MVVM 框架来制作 WPF 应用程序。除了鼓励您使用 MVVM 模式解耦应用程序之外,它还有一些非常强大的机制来处理Screens、Conductors 和 Composition。Caliburn.Micro 的作者 Rob Eisenberg 编写了一些教程,对项目文档下的框架以及如何使用该框架进行了广泛的解释。interwebz 也有很多资源,google一下!:)
I can also recommend Pluralsight's WPF and XAML Fundamentalsand WPF Advanced Topics, they should cover what whatever is worth knowing about WPF :)
我还可以推荐 Pluralsight 的WPF 和 XAML Fundamentals以及WPF Advanced Topics,它们应该涵盖关于 WPF 的任何值得了解的内容:)

