How to get all Controls' ControlTemplates Programmatically?(UWP)

你说的曾经没有我的故事 提交于 2019-12-02 09:16:07

问题


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)


回答1:


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

The file path is C:\Program Files[(x86)]\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\{sdk}\Generic

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

My path is C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.14393.0\Generic

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

Or you also can download the file.

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



来源:https://stackoverflow.com/questions/45603328/how-to-get-all-controls-controltemplates-programmaticallyuwp

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