使用WPF DLL在UWP应用 [英] Using WPF dll's in UWP app

查看:268
本文介绍了使用WPF DLL在UWP应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个UWP应用程序,并出于某种原因我无法引用 PresentationFramework.dll 。它包含了我想用(具体而言, System.Windows.Controls.DataGrid 一些WPF控件,但它们不提供通用的Windows下>>在参考经理扩展。这是为什么,我怎么能解决这个问题。

I'm writing a UWP app, and for some reason I'm unable to reference PresentationFramework.dll. It contains some WPF controls I want to use (specifically, System.Windows.Controls.DataGrid, but they aren't available under Universal Windows >> Extensions in the reference manager. Why is this, and how can I fix it?

推荐答案

TL; DR:不能使用在WPF控件UWP。

TL;DR: You can't use WPF controls in UWP.

WPF和UWP是两种完全不同的API有不同的.NET框架。而WPF可以访问完整的.NET框架,UWP有一个非常有限的API。如果您想了解更多关于不同平台和编译器,这 MSDN博客文章是一个很好的切入点。

WPF and UWP are two totally different APIs with a different .NET framework. While WPF has access to the full .NET Framework, UWP has a much more limited API. If you want to read more on the different platforms and compilers, this msdn blog post is a good entry point.

< IMG SRC =http://i.stack.imgur.com/9rpoC.pngALT =在这里输入的形象描述>

您是因此,不能添加任何标准的DLL到UWP应用的参考。如果你想分享WPF和UWP之间的代码,你将不得不使用的 便携式类库,在你的目标,你所需要的平台。

You are thus unable to add any standard dlls as a reference to an UWP app. If you want to share code between WPF and UWP, you'll have to use a Portable Class Library, in which you target the platforms you need.

和为WPF和UWP的XAML命名空间是不同的,以及,你不会找到许多便携式控制。因此,对于UWP发展,您需要使用UWP控件(相当于他们WPF同行)。特别提示:如果您正在寻找第三方控件,你也可以找'的WinRT作为WinRT的用于于Windows 8 / 8.1控制,但它是相同的技术。

And as the XAML namespaces for WPF and UWP are different as well, you won't find many portable controls. So for UWP development you'll need to use UWP controls (equivalent to their WPF counterparts). Bonus tip: if you're looking for 3rd party controls, you can also look for 'winrt' controls as winrt was used for Windows 8/8.1, but it's the same technology.

这篇关于使用WPF DLL在UWP应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆