Never
Never

Reputation: 323

Trigger on Text in TextBox

I have this code:

<Style x:Key="qwe" TargetType="{x:Type TextBox}">
    <Style.Triggers>
        <Trigger Property="Text" Value="qwe">
            <Setter Property="IsEnabled" Value="False"/>
        </Trigger>
    </Style.Triggers>
</Style>

But when I have "qwe" in TextBox, It is still enabled. What is wrong?

Upvotes: 0

Views: 1016

Answers (1)

brunnerh
brunnerh

Reputation: 185445

You referenced the style on some TextBox, right?

<TextBox Style="{StaticResource qwe}"/>

Works for me...

Make sure you don't override the trigger by setting IsEnabled on the TextBox itself.

Upvotes: 1

Related Questions