为什么找不到WPF属性IsDefaulted? [英] Why is the WPF property IsDefaulted not found?
问题描述
我正在使用以下示例处理按钮模板: http://msdn.microsoft.com/en-us/library/ms753328.aspx
I was working on my button template with this example: http://msdn.microsoft.com/en-us/library/ms753328.aspx
我发现"IsDefaulted"属性非常有用,但无法使用.我有以下触发器设置:
I found the "IsDefaulted" property quite useful, but can't use it. I have the following trigger setup:
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Presenter" Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="White" Opacity="0.2" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsDefaulted" Value="true">
<Setter TargetName="Canvas" Property="Height" Value="40" />
<Setter Property="FontSize" Value="18" />
</Trigger>
</ControlTemplate.Triggers>
但是,在构建时,我得到:
However, on build, I get:
在类型'System.Windows.Controls.Control'上找不到模板属性'IsDefaulted'.
Cannot find the Template Property 'IsDefaulted' on the type 'System.Windows.Controls.Control'.
这很奇怪,因为Google没有告诉我任何有关此的信息,MSDN也没有告诉我任何其他信息.经过一些测试,我发现:
Which is strange, because Google doesn't tell me anything about this, nor does MSDN or anything else. After some testing, I figured that:
-IsMouseOver:有效
-IsMouseOver: Works
-IsPressed:不起作用
-IsPressed: Doesn't work
-IsDefaulted:不起作用
-IsDefaulted: Doesn't work
-IsKeyboardFocused:有效
-IsKeyboardFocused: Works
-IsEnabled:有效
-IsEnabled: Works
臭虫?我做错了什么?
推荐答案
已解决:
<ControlTemplate TargetType="Button">
就这么简单:)
这篇关于为什么找不到WPF属性IsDefaulted?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!