XAML vs WPF vs Store App vs Phone App vs UWA

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35636913/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 13:41:39  来源:igfitidea点击:

XAML vs WPF vs Store App vs Phone App vs UWA

wpfxamlwindows-store-apps

提问by Yeasin Abedin Siam

I know that XAML is used for designing UI in combination with Blend. I am confused with so many terms, like, how XAML comes into play for WPF, Store App, Phone App or UWA. Morever, what is the difference between WPF, Store App, Phone App and UWA. Does all that means that old Desktop Project will no longer be used and replace by either WPF or Store App or UWA?

我知道 XAML 用于结合 Blend 设计 UI。我对很多术语感到困惑,例如 XAML 如何在 WPF、Store App、Phone App 或 UWA 中发挥作用。另外,WPF、Store App、Phone App和UWA有什么区别。这是否意味着旧的桌面项目将不再被 WPF 或 Store App 或 UWA 使用和取代?

回答by Aniruddha Varma

When .NET was released in ~2000, you could use WinForms to make desktop applications for Windows. It provides access to 'native' controls (i.e. A Button made in WinForms actually is a Windows Button control from user32.dll) by wrapping the Windows API in managed code. These can run in any version of Windows which has the appropriate .NET framework version installed, including upto Windows 10.

当 .NET 在 2000 年左右发布时,您可以使用 WinForms 为 Windows 制作桌面应用程序。它通过将 Windows API 封装在托管代码中来提供对“本机”控件的访问(即,在 WinForms 中制作的按钮实际上是来自 user32.dll 的 Windows 按钮控件)。这些可以在安装了相应 .NET 框架版本的任何版本的 Windows 中运行,包括 Windows 10。

In 2006, WPF was released which is an alternative to WinForms. WPF uses XAML, which is a language based on XML, to declare the user interface elements. In a simple WPF app, the .xaml file describes the GUI and the code-behind file describes the logic. DirectX is used to draw whatever is described in the .xaml into the window.

2006 年,WPF 发布,它是 WinForms 的替代品。WPF 使用 XAML(一种基于 XML 的语言)来声明用户界面元素。在简单的 WPF 应用程序中,.xaml 文件描述 GUI,代码隐藏文件描述逻辑。DirectX 用于将 .xaml 中描述的任何内容绘制到窗口中。

Like Winforms, programs made using WPF can run in any version of Windows which has the appropriate .NET framework version installed, including upto Windows 10. Note that using XAML is completely optional. Whatever user interface elements you describe using XAML can also be made using your .NET language C# or VisualBasic.NET. But using XAML is usually simpler. See To XAML or not to XAML (MSDN Blogs).

与 Winforms 一样,使用 WPF 制作的程序可以在安装了相应 .NET 框架版本的任何 Windows 版本中运行,包括 Windows 10。请注意,使用 XAML 是完全可选的。您使用 XAML 描述的任何用户界面元素也可以使用您的 .NET 语言 C# 或 VisualBasic.NET 制作。但使用 XAML 通常更简单。请参阅To XAML or not to XAML(MSDN 博客)

From XAML (Wikipedia):

来自XAML(维基百科)

As XAML is simply based on XML, developers and designers are able to share and edit content freely amongst themselves without requiring compilation.

由于 XAML 仅基于 XML,因此开发人员和设计人员无需编译即可在他们之间自由共享和编辑内容。

From ~2012 along with Windows 8, a new kind of app called metro/modern/windows-8/windows-store-apps can be made. These apps are similar to WPF in that they use XAML for describing the GUI. These apps can run only in Windows 8, 8.1 and Windows 10. Windows 8.1 added some improvements and features but remained mostly the same. The same technology was used to make apps for Windows Phone.

从 2012 年开始,随着 Windows 8 的出现,可以制作一种名为 Metro/modern/windows-8/windows-store-apps 的新型应用程序。这些应用程序类似于 WPF,因为它们使用 XAML 来描述 GUI。这些应用程序只能在 Windows 8、8.1 和 Windows 10 中运行。Windows 8.1 添加了一些改进和功能,但基本保持不变。同样的技术也被用于为 Windows Phone 制作应用程序。

With the release of Windows 10, Microsoft made UWP (Universal Windows Platform) through which you can use the same code base to target differnt kinds of devices (desktop/mobile/xbox/IoT/holographic). These apps made for the UWP are similar to the earlier Windows 8/8.1 apps. Like before, XAML is used to describe the GUI.

随着 Windows 10 的发布,微软制作了 UWP(通用 Windows 平台),通过它你可以使用相同的代码库来定位不同类型的设备(桌面/移动/xbox/IoT/全息)。这些为 UWP 制作的应用程序类似于早期的 Windows 8/8.1 应用程序。和以前一样,XAML 用于描述 GUI。

Only for the Windows Store apps, there is no backwardcompatibility. The timeline goes Windows 8-> Windows 8.1-> Windows 10/UWP. An app made in UWP can onlyrun in Windows 10 and an app made in Windows 8.1 can not run in Windows 8.

仅适用于 Windows 应用商店应用程序,没有向后兼容性。时间线是Windows 8-> Windows 8.1-> Windows 10/UWP。在 UWP 中制作的应用程序只能在 Windows 10 中运行,而在 Windows 8.1 中制作的应用程序无法在 Windows 8 中运行。

回答by Yassine Yousfi

I would highly recommend referring to this discussion thread in stopbyte, it has far more details and explanation of the concepts behind WPF, UWP And WinRT.

我强烈建议在 stopbyte 中参考这个讨论线程,它有更多关于WPF、UWP 和 WinRT 背后概念的详细信息和解释

As for WinForms, I believe it's history now. Have been almost replaced by WPF. I believe Microsoft has stopped developing Windows Forms and probably has stopped maintaining it as well.

至于 WinForms,我相信它现在已经成为历史。几乎已经被WPF取代了。我相信微软已经停止开发 Windows Forms 并且可能也停止维护它。