开发者

Please help move WPF trigger behavior to Silverlight

The WPF code:

 <TextBox>
        <TextBox.Resources>
            <Style TargetType="TextBox">
                <Style.Triggers>
                    <Trigger Property="Text" Value="1">
                        <Setter Property="Background" Value="Red"/>
                    </Trigger>
                    <Trigger Property="Text" Value="2">
                        &开发者_运维技巧lt;Setter Property="Background" Value="Green"/>
                    </Trigger>
                    <Trigger Property="Text" Value="3">
                        <Setter Property="Background" Value="Blue"/>
                    </Trigger>

                </Style.Triggers>
            </Style>
        </TextBox.Resources>
    </TextBox>

Can you write the same in Silverlight? Please dont vote to close this question. Thanks!


Or... you can install the "Blend SDK" (it's free), which extends Silverlight's triggers and allows you to do exactly that.


Triggers are not supported in Silverlight. You can use a IValueConverter to change the value to the correct color.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜