问题
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