如何获得所有控件'以编程方式控制模板?(UWP) [英] How to get all Controls' ControlTemplates Programmatically?(UWP)

查看:16
本文介绍了如何获得所有控件'以编程方式控制模板?(UWP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Although I know I can get all ControlTemplates from MSDN.,it's not convenient enough. I tried to get controltemplates by adding a reference to the windows.winmd,then getting templates programmatically like WPF.but I got an Exception,then I looked up the windows.winmd,I found that the Control type didn't have a public constructor,maybe the private constructor caused this Exception. I also tried to get templates in a UWP App,but I had no classes to serialize and deserialize the ControlTemplate type into Xaml format in UWP. (And UWP's XamlWriter & Control behaves differently from the ones in Wpf)

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

(I feel sorry about my poor English)

推荐答案

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

All the style that you can find in your PC when you installed sdk.

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

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

If you cant find the Windows Kits in Program Files that you may find it in Program Files (x86).

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

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

I can see the generic.xaml file that include all the style.

或者您也可以下载文件.

请参阅:https://msdn.microsoft.com/en-us/library/windows/apps/mt299136.aspx

这篇关于如何获得所有控件'以编程方式控制模板?(UWP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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