Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • 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.

                                • 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 Rating Importance Sort by
                                0

                                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.
                                • 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.

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners