我是靠谱客的博主 高兴书本,这篇文章主要介绍(WPF) Textbox 每次输入触发事件处理,现在分享给大家,希望可以做个参考。

1.  Code behind. 

复制代码
1
2
3
4
protected void TextBox1_TextChanged(object sender, EventArgs e) { Label1.Text = Server.HtmlEncode(TextBox1.Text); }

2.  Event trigger

复制代码
1
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"


 

复制代码
1
2
3
4
5
<i:Interaction.Triggers> <i:EventTrigger EventName="TextChanged"> <i:InvokeCommandAction Command="{Binding StartTextChanged}" /> </i:EventTrigger> </i:Interaction.Triggers>

3.  MVVM ( Prefered)

复制代码
1
<TextBox Text="{Binding MyText,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

 

转载于:https://www.cnblogs.com/fdyang/p/10160503.html

最后

以上就是高兴书本最近收集整理的关于(WPF) Textbox 每次输入触发事件处理的全部内容,更多相关(WPF)内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部