码迷,mamicode.com
首页 > Windows程序 > 详细

【WPF系列】-TextBox常用点

时间:2014-12-04 15:29:31      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   io   ar   color   sp   on   

 

高级实例:

通过dataTriger来给TextBox焦点

Using XAML to Set Focus on a Textbox in WPF Desktop Applications

bubuko.com,布布扣

<Style x:Key="LayoutRoot" TargetType="Grid">
        <Style.Triggers>
            <!--these are the triggers that make the code cursor jump from box 1 to box 2 to box 3.-->
            <DataTrigger Binding="{Binding ElementName=CodeDigit1, Path=Text.Length}" Value="1">
                <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=CodeDigit2}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding ElementName=CodeDigit2, Path=Text.Length}" Value="1">
                <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=CodeDigit3}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding ElementName=CodeDigit3, Path=Text.Length}" Value="1">
                <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=CodeDigit4}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding ElementName=CodeDigit4, Path=Text.Length}" Value="1">
                <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=ConnectButton}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

【WPF系列】-TextBox常用点

标签:des   style   blog   http   io   ar   color   sp   on   

原文地址:http://www.cnblogs.com/HQFZ/p/4142941.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!