Current filter:
                                You should refresh the page.
                                  • When I use mouse or Shitf+Tab key to move among the controls on form, specified events are fired only once each time I move the focus. When I use Tab key to move forward, target control fires GotFocus event, then LostFocus and GotFocus event again. Attached sample shows simple example for DevExpress.Xpf.Editors.TextEdit, but other editor controls do the same.

                                • Marina (DevExpress Support) 07.28.2011

                                  David,

                                  I have attached a solution that illustrates how to overcome this issue. Please review it. This should be helpful.

                                  Thank you, Marina

                                • David Grinč 07.29.2011

                                  It is helpfull, thank you.

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                We have researched this issue. The GotFocus and LostFocus are standard events. We do not raise them ourselves. Our TextEdit wraps the TextBox. When you use keys, you focus the TextEdit, but then focus changes from the TextEdit to the internal TextBox. This is the reason why the GotFocus event if fired twice. You should listen to this event only for the internal editor. In some cases, it may be necessary to listen to this event for both elements. This is the reason why we do not plan to change this behavior on our side. I hope my solution is applicable.

                                Thank you, Marina

                                • Craig Tyler 06.22.2017
                                  It appears after 6 years it is still ok to fire LostFocus events when a control hasn't lost focus.
                                • Ivan (DevExpress Support) 06.23.2017
                                  Hi Craig,

                                  As Marina correctly mentioned, this behavior occurs because our editors display their values using an addition control. The control type may depend on the used editor, but text editors mostly use TextBox. When an internal editor is focused, the editor loses the focus, and this is the only reason why the standard LostFocus event is raised.
                                  If you are looking for an event that allows you to check if the focus is within your text editor, I suggest you handle the IsKeyboardFocusWithinChanged event instead. Please try this approach to see if it allows you to achieve your goal.