开发者

xaml how to create a trigger for textbox? active when typing

开发者 https://www.devze.com 2023-02-22 06:19 出处:网络
I have a textbox, i want add a trigger, when i click that textbox, the textbox wi开发者_高级运维ll change border color, untill typing is finish

I have a textbox, i want add a trigger, when i click that textbox, the textbox wi开发者_高级运维ll change border color, untill typing is finish please help me useing xaml


Try this

    <Style TargetType="{x:Type TextBox}">
        <Style.Triggers>
            <Trigger Property="IsFocused"  Value="True">
                <Setter Property="BorderBrush" Value="Red"/>
                <Setter Property="BorderThickness" Value="2"/>
            </Trigger>
        </Style.Triggers>
    </Style>


You are asking for a Trigger but a different styling for the Focused state would be my preferred way of doing this

0

精彩评论

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