invoking a button mouse click by pressing enter key in mvvm
how can u invoke a button mouse click by pressing enter key in mvvm?
I would like to submit a xaml form by pressing enter.
I will describe the problem: Lets assume I have a fiel called: Name, the data in the field is binded to the Name property in the view model. the data is updated in the property only when the textbox looses focus.
mouse click on the button makes the textbox loosing focus, but pressing enter cannot do that. so the result is the the data in the textbox is not updated in the property. therefore I cannot submit my form with pressing enter key, and I cannot use validation tools on my field as well because of this.
what is the solution for this problem?
thanks
Re: invoking a button mouse click by pressing enter key in mvvm
Quote:
Originally Posted by
steve33
what is the solution for this problem?
Change the binding so the text changes when the user changes the text rather than after focus is lost. Wait to perform the validation until the user clicks on the button or presses enter.
What binding on you currently using on the text box?