开发者

Why is the WPF property IsDefaulted not found?

开发者 https://www.devze.com 2022-12-19 21:51 出处:网络
I was working on my button template with this example: 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

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="Whit开发者_StackOverflow社区e" 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:

Cannot find the Template Property 'IsDefaulted' on the type 'System.Windows.Controls.Control'.

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: Works

-IsPressed: Doesn't work

-IsDefaulted: Doesn't work

-IsKeyboardFocused: Works

-IsEnabled: Works

Bug? Something I'm doing wrong?


Got it fixed:

<ControlTemplate TargetType="Button">

As simple as that :)

0

精彩评论

暂无评论...
验证码 换一张
取 消