在input中回车需要触发按钮或其它方法事件
<TextBox Grid.Row="0" Text="{Binding ThingNameOrNo,Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}"  Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Width="250"  >
    <TextBox.InputBindings>
        <KeyBinding Command="{Binding SelectEnterFunCommand}" Key="Enter"/>
    </TextBox.InputBindings>
</TextBox>注意:UpdateSourceTrigger=PropertyChanged   一定要加这一句,不然刚开始进入回车是无效的
                
- 本文标题: WPF之input回车事件
- 文章分类:【WinForm/WPF】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.