I created some textboxes and I want user to enter decimal values into them. In every application I have ever used, when I type something into the textbox and hit enter, the value is accepted and textbox lose focus. How can I do it in my app?
I know it should be relatively easy to do it with a key event, but maybe there is a command or something.
I searched the stackoverflow but I only found questions about how to keep focus after hitting enter…
C# – WPF how to make textbox lose focus after hitting enter
cfocustextboxwpf
Best Answer
You can also create a generic behavior which can be easily applied to any textbox within your application. Here is a sample behavior class:-
To use this class in your xaml, just include it in textbox behaviors collection like this :-
Here "i" refers to System.Windows.Interactivity namespace.