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包

相关推荐
bubuly1 小时前
软件开发全流程注意事项:从需求到运维的全方位指南
大数据·运维·数据库
xixixi777773 小时前
基于零信任架构的通信
大数据·人工智能·架构·零信任·通信·个人隐私
Hello.Reader4 小时前
Flink 自适应批执行(Adaptive Batch Execution)让 Batch 作业“边跑边优化”
大数据·flink·batch
LaughingZhu5 小时前
Product Hunt 每日热榜 | 2026-01-31
大数据·人工智能·经验分享·搜索引擎·产品运营
babe小鑫5 小时前
中专学历进入快消大厂终端销售岗位的可行性分析
大数据
samFuB5 小时前
【工具变量】区县5A级旅游景区DID数据集(2000-2025年)
大数据
百夜﹍悠ゼ5 小时前
数据治理DataHub安装部署
大数据·数据治理
wdfk_prog6 小时前
解决 `git cherry-pick` 引入大量新文件的问题
大数据·git·elasticsearch
洛阳纸贵6 小时前
JAVA高级工程师--Elasticsearch
大数据·elasticsearch·搜索引擎
TracyCoder1237 小时前
ElasticSearch内存管理与操作系统(二):深入解析 Circuit Breakers(熔断器)机制
大数据·elasticsearch·搜索引擎