Следующий шаблон работает нормально, если пользователь нажимает Введите, хотя я хочу, чтобы команда срабатывала, когда TextBox
теряет фокус. Как я могу это сделать?Как запустить команду 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