0
如果用户按下输入,但以下模板可以正常工作,但我也希望在TextBox
失去焦点时触发该命令。我怎样才能做到这一点?如何在WPF中失去焦点时触发文本框命令?
以下是我TextBox
模板
<DataTemplate x:Key="PhantomNameEditTemplate">
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}">
<TextBox.InputBindings>
<KeyBinding Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=DataGrid}, Path=DataContext.RenameCommand}" CommandParameter="{Binding}" Key="Enter" />
</TextBox.InputBindings>
</TextBox>
</DataTemplate>
谢谢,我没有使用MVVM框架,并且工作完美。 – Bob 2014-09-24 14:40:16