TextBox.InputBindings 绑定按键事件
<TextBox Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="250" md:HintAssist.Hint="查找待办事项" md:TextFieldAssist.HasClearButton="True"> <TextBox.InputBindings> <KeyBinding Key="Enter" Command="{Binding ExecuteCommand}" CommandParameter="查询" /> </TextBox.InputBindings> </TextBox>