<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包