Is it possible to use UWP APIs in a WPF app?

你离开我真会死。 提交于 2019-12-05 22:37:14

问题


One example would be the new notification APIs for Windows 10 universal platform. Can I use this set of APIs in a WPF app? If so are there any limitations?

Links to documentation regarding this would be much appreciated.


回答1:


No, You can't - at least for now - But there's a progress on a project called "Centennial" Which will enable you to do so.

More see "bridges".

Yes, you can now.
https://blogs.windows.com/buildingapps/2017/01/25/calling-windows-10-apis-desktop-application/




回答2:


It is possible to use UWP APIs in a WPF app. However not all UWP APIs can be used in a WPF app.

There are exceptions to the rule that Windows 10 APIs are accessible from PC software. The first big exception concerns XAML UI APIs. The XAML framework in UWP is different from the one in WPF and you really don’t want to be mixing them up, anyways.

The second set of APIs that you can’t use are ones that depend on an app’s package identity. UWP apps have package identities while PC software does not. Package identity information can be found in the app manifest file.

How do you determine which Windows 10 APIs require a package identity and which do not? The easiest way is to refer to this MSDN topic.

For how to access the Windows 10 APIs from WPF, please refer to this answer and also see the blog Calling Windows 10 APIs From a Desktop Application (Please note the name of the references in the blog is not right, so I'd suggest you refer the answer in SO).



来源:https://stackoverflow.com/questions/33692898/is-it-possible-to-use-uwp-apis-in-a-wpf-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!