zoukankan      html  css  js  c++  java
  • (WPF) Textbox 每次输入触发事件处理

    1.  Code behind. 

    protected void TextBox1_TextChanged(object sender, EventArgs e)  
    {  
       Label1.Text = Server.HtmlEncode(TextBox1.Text);  
    }  

    2.  Event trigger

          xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"


     

                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="TextChanged">
                        <i:InvokeCommandAction Command="{Binding StartTextChanged}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>

    3.  MVVM ( Prefered)

    <TextBox Text="{Binding MyText,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
  • 相关阅读:
    常见问题
    查询
    多对多关系
    prototype & __proto__
    new operator
    用户
    express.Router
    Express 应用生成器
    LeanCloud
    npm常用命令
  • 原文地址:https://www.cnblogs.com/fdyang/p/10160503.html
Copyright © 2011-2022 走看看