ControlTemplate
是否在WPF应用程序中使用?文件名为“CheckBoxTemplates.xaml”,并且与主应用程序不在同一程序集中。请注意,当我搜索文件名和资源键时,没有结果。此外,在解决方案中搜索资源键是不可靠的,特别是当有五个资源字典文件包含相同的键时。<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna">
<Style x:Key="invertedCheckBox"
TargetType="CheckBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox"
...
更多信息
虽然user2250152的答案对于上面的XAML是正确的,但它不能可靠地确定样式是否在使用中。我这么说是因为当我用这种技术来处理另一个样式时,我发现有五个资源字典文件包含相同的键值。因此,我们必须考虑如何可靠地确定哪个样式是使用了定义了重复键的。