【问题标题】:How to get all Controls' ControlTemplates Programmatically?(UWP)如何以编程方式获取所有控件的 ControlTemplates?(UWP)
【发布时间】:2018-01-18 02:09:41
【问题描述】:

虽然我知道我可以从 MSDN 获得所有的 ControlTemplates。但这还不够方便。 我尝试通过添加对 windows.winmd 的引用来获取 controltemplates,然后以编程方式获取模板 就像WPF一样。但是我得到了一个异常,然后我查看了windows.winmd,我发现Control类型没有公共构造函数,可能是私有构造函数导致了这个异常。 我也尝试在 UWP 应用程序中获取模板,但我没有 在 UWP 中将 ControlTemplate 类型序列化和反序列化为 Xaml 格式的类。 (而且 UWP 的 XamlWriter & Control 的行为与 Wpf 中的不同)

(我为我的英语不好感到抱歉)

【问题讨论】:

    标签: c# xaml uwp uwp-xaml


    【解决方案1】:

    安装 sdk 时您可以在 PC 中找到的所有样式。

    文件路径为C:\Program Files[(x86)]\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\{sdk}\Generic

    如果您在 Program Files 中找不到 Windows Kits,您可以在 Program Files (x86) 中找到它。

    我的路径是C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.14393.0\Generic

    我可以看到包含所有样式的generic.xaml 文件。

    或者您也可以下载file

    见:https://msdn.microsoft.com/en-us/library/windows/apps/mt299136.aspx

    【讨论】:

      猜你喜欢
      • 2021-01-31
      • 1970-01-01
      • 2014-02-05
      • 1970-01-01
      • 2016-03-22
      • 2019-06-24
      • 1970-01-01
      • 2012-03-19
      • 1970-01-01
      相关资源
      最近更新 更多