WPF TextBox内容修改命令

<TextBox

Background="{x:Null}"

Text="{Binding SearchForContent, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">

<i:Interaction.Triggers>

<i:EventTrigger EventName="TextChanged">
<i:InvokeCommandAction Command="{Binding TextChangedCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="LostFocus">
<i:InvokeCommandAction Command="{Binding LostFocusAndGotFocusCommand}" CommandParameter="LostFocus" />
</i:EventTrigger>
<i:EventTrigger EventName="GotFocus">
<i:InvokeCommandAction Command="{Binding LostFocusAndGotFocusCommand}" CommandParameter="GotFocus" />
</i:EventTrigger>

</i:Interaction.Triggers>

</TextBox>

xmlns:i="http://schemas.microsoft.com/xaml/behaviors"

后台的话根据需要,自己声明命令,命令事件即可

这玩意儿是开源的,需要下载ViewModelBase包

相关推荐
Theodore_102244 分钟前
大数据(1) 大数据概述
大数据·hadoop·数据分析·spark·hbase
Aurora_NeAr1 小时前
Apache Spark详解
大数据·后端·spark
IvanCodes3 小时前
六、Sqoop 导出
大数据·hadoop·sqoop
lph19723 小时前
wpf的converter
wpf
fyifei05583 小时前
WPF学习PropertyChanged
wpf
代码匠心3 小时前
从零开始学Flink:揭开实时计算的神秘面纱
java·大数据·后端·flink
爱炸薯条的小朋友3 小时前
C#由于获取WPF窗口名称造成的异常报错问题
windows·c#·wpf
baivfhpwxf20234 小时前
wpf ListBox 去除item 单击样式
wpf
诗仙&李白4 小时前
lnnovationHubTool,用prism+WPF编写的MVVM模式的快速上位机软件开发框架平台
wpf·mvvm·prism·上位机软件开发框架平台