Executing viewmodels command on enter in TextBox
问题 I want to execute a command in my viewmodel when the user presses enter in a TextBox. The command works when bound to a button. <Button Content="Add" Command="{Binding Path=AddCommand}" /> But I can't bring it to work from the TextBox. I tried an Inputbinding, but it didn't work. <TextBox.InputBindings> <KeyBinding Command="{Binding Path=AddCommand}" Key="Enter"/> </TextBox.InputBindings> I also tried to set the working button as default, but it doesn't get executed when enter is pressed.