您的位置:首页 > 其它

WPF MVVM 中TextBox回车触发Command

2018-01-19 20:18 344 查看
引用命名空间

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"


修改TextBox

<TextBox >
 <i:Interaction.Triggers>
  <ei:KeyTrigger FiredOn="KeyUp" Key="Return">
   <i:InvokeCommandAction Command="{Binding FuzzyQueryCommand}"></i:InvokeCommandAction>
  </ei:KeyTrigger>
 </i:Interaction.Triggers>
</TextBox>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息