WPF:内置样式在哪里定义

时间:2018-11-10 15:12:58

标签: wpf

我在工具栏中有一个RepeatButton。我希望它具有与工具栏按钮相同的视觉外观。但是ToolBar.ButtonStyleKey由于TargetType不同而无法正常工作。那么(为各种主题定义的)内置样式在哪里?如何为RepeatButton克隆ToolBar.ButtonStyle?

1 个答案:

答案 0 :(得分:1)

它们在C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\PresentationFramework*程序集中定义。您可以使用诸如dotPeek之类的反编译器来提取模板,也可以在Visual Studio或Blend中的设计模式下右键单击控件,然后选择Edit Template-> Edit a Copy将默认模板复制到您的XAML标记中。

  

我尝试了一下,但得到了Template的{​​{1}},但没有ToolBarButton的样式。搜索以ToolBarButtonStyleKey结尾,但找不到WPF的ToolBarButtonStyle。

就在这里

ToolBar
相关问题