特定版本的 Windows 10 的目标代码,例如 Build 10586 [英] Target code for a specific version of Windows 10, like Build 10586

查看:40
本文介绍了特定版本的 Windows 10 的目标代码,例如 Build 10586的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如您所知,ElementCompositionPreview.GetElementVisual 可在 Windows 10 Build 10586 上访问,我希望有一个可以同时针对 Build 10586 和 Build 10240 的应用程序.

As you know ElementCompositionPreview.GetElementVisual is accessible on Windows 10 Build 10586, I would like to have one application that can target both Build 10586 and Build 10240.

有没有人知道当应用程序在 Build 10586 上运行时如何使用 Compositor 和 ElementCompositionPreview.GetElementVisual 以及在运行 build 10240 时如何使用其他东西.

Does anyone have an idea of how I could use Compositor and ElementCompositionPreview.GetElementVisual when the application is running on Build 10586 and something else when it is running the build 10240.

像这样:

  #if WINDOWS_UWP Build 10586
       _compositor = new Compositor();
       _root = ElementCompositionPreview.GetElementVisual(myElement);
  #endif


 #if WINDOWS_UWP Build 10240
  //other code
 #endif

有什么想法吗?

推荐答案

如您所知,ElementCompositionPreview.GetElementVisual 可在 Windows 10 Build 10586 上访问,我希望有一个可以同时针对 Build 10586 和 Build 10240 的应用程序

As you know ElementCompositionPreview.GetElementVisual is accessible on Windows 10 Build 10586, I would like to have one application that can target both Build 10586 and Build 10240

对于UWP app,只有一个Target版本,根据您的需求,我们可以设置Target版本为Build 10586,最小版本:Build 10240

For UWP app, there is only one Target version, for your requirement, we can set Target version to Build 10586 and the Min version: Build 10240

有没有人知道当应用程序在 Build 10586 上运行时如何使用 Compositor 和 ElementCompositionPreview.GetElementVisual 以及在运行 build 10240 时如何使用其他东西.

Does anyone have an idea of how I could use Compositor and ElementCompositionPreview.GetElementVisual when the application is running on Build 10586 and something else when it is running the build 10240.

请使用Windows.Foundation.Metadata.ApiInformation API 动态检测特点:

Please use Windows.Foundation.Metadata.ApiInformation API to dynamically detect features:

if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview"))
{
                if (Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", "GetElementVisual"))
                {
                    _compositor = new Windows.UI.Composition.Compositor();
                    _root = Windows.UI.Xaml.Hosting.ElementCompositionPreview.GetElementVisual(btn1);
                }
                else
                {
                    //Do other things
                }
}

这里有一篇很好的文章来介绍这个 API:使用 API 契约动态检测特征(10 x 10)

Here is a good article to introduce this API: Dynamically detecting features with API contracts (10 by 10)

这篇关于特定版本的 Windows 10 的目标代码,例如 Build 10586的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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