如何在没有 Visual Studio 设计器的情况下查看 XAML 控件的默认模板和样式?
How do I view a XAML control's default templates and styles without the Visual Studio designer?
根据 MSDN 上的控件模板文档,官方支持的查看控件默认模板和样式的方法是使用 Visual Studio 的设计器(好吧,从技术上讲,文档大纲,但这仅适用于打开的设计器):
A fast way to apply themes to your controls is to right-click on a control on the Microsoft Visual Studio Document Outline and select Edit Theme or Edit Style (depending on the control you are right-clicking on). You can then apply an existing theme by selecting Apply Resource or define a new one by selecting Create Empty.
[...]
The topics that document the styles and templates for XAML controls show you excerpts of the same starting XAML you'd see if you used the Edit Theme or Edit Style techniques explained previously. Each topic lists the names of the visual states, the theme resources used, and the full XAML for the style that contains the template. The topics can be useful guidance if you've already started modifying a template and want to see what the original template looked like, or to verify that your new template has all of the required named visual states.
但是,开发人员可能无法访问 Visual Studio Designer。
我必须使用哪些官方、保证最新的替代方案来查看默认模板和样式?
谢谢!
您可以在 generic.xaml 文件中找到控件的默认样式。
如果 autocomplete/IntelliSense 在您的 Visual Studio 中工作:
- 创建一个使用内置样式的控件,例如
Style="{StaticResource ButtonRevealStyle}"
- 将指针悬停在
ButtonRevealStyle
上并按 F12 或单击鼠标右键并 select 转到定义 选项访问 generic.xaml.
- 在generic.xaml中可以在搜索框中用
Default style for Windows.UI.Xaml.Controls.Button
等语句搜索默认样式,可以找到[的默认样式=13=]控制。
注意,如果不需要ButtonRevealStyle
.
样式,请去掉Style="{StaticResource ButtonRevealStyle}"
语句
您还可以在 Windows SDK 中找到该文件。它位于 C:\Program Files (x86)\Windows Kits\DesignTime\CommonConfiguration\Neutral\UAP.0.18362.0\Generic (其中 10.0.18362.0 是SDK的版本,可以替换成你使用的版本。
根据 MSDN 上的控件模板文档,官方支持的查看控件默认模板和样式的方法是使用 Visual Studio 的设计器(好吧,从技术上讲,文档大纲,但这仅适用于打开的设计器):
A fast way to apply themes to your controls is to right-click on a control on the Microsoft Visual Studio Document Outline and select Edit Theme or Edit Style (depending on the control you are right-clicking on). You can then apply an existing theme by selecting Apply Resource or define a new one by selecting Create Empty.
[...]
The topics that document the styles and templates for XAML controls show you excerpts of the same starting XAML you'd see if you used the Edit Theme or Edit Style techniques explained previously. Each topic lists the names of the visual states, the theme resources used, and the full XAML for the style that contains the template. The topics can be useful guidance if you've already started modifying a template and want to see what the original template looked like, or to verify that your new template has all of the required named visual states.
但是,开发人员可能无法访问 Visual Studio Designer。
我必须使用哪些官方、保证最新的替代方案来查看默认模板和样式?
谢谢!
您可以在 generic.xaml 文件中找到控件的默认样式。
如果 autocomplete/IntelliSense 在您的 Visual Studio 中工作:
- 创建一个使用内置样式的控件,例如
Style="{StaticResource ButtonRevealStyle}"
- 将指针悬停在
ButtonRevealStyle
上并按 F12 或单击鼠标右键并 select 转到定义 选项访问 generic.xaml. - 在generic.xaml中可以在搜索框中用
Default style for Windows.UI.Xaml.Controls.Button
等语句搜索默认样式,可以找到[的默认样式=13=]控制。
注意,如果不需要
样式,请去掉ButtonRevealStyle
.Style="{StaticResource ButtonRevealStyle}"
语句- 创建一个使用内置样式的控件,例如
您还可以在 Windows SDK 中找到该文件。它位于 C:\Program Files (x86)\Windows Kits\DesignTime\CommonConfiguration\Neutral\UAP.0.18362.0\Generic (其中 10.0.18362.0 是SDK的版本,可以替换成你使用的版本。