Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hi,

                                    I have set the property SelectAllOnGotFocus and would like the contents of the textbox in focus is highlighted. Unfortunately not. When Texteditbox I have a mask with the numeric type set c.

                                    Why it does not work?

                                    Example in XAML:

                                    <dxe:TextEdit Height="30" HorizontalAlignment="Left" Margin="60,66,0,0" Name="textEdit1" VerticalAlignment="Top" Width="233" MaskType="Numeric" Mask="c" SelectAllOnGotFocus="True" />

                                0

                                Hi Stefan,

                                Text is selected only when the editor gets focus via the keyboard for the first time only. It works the same way for editors with and without masks. We will elaborate on this behavior in the documentation. If you want the editor to select text each time it gains focus, please use the following code:

                                [C#]
                                public MainWindow() { InitializeComponent(); EventManager.RegisterClassHandler(typeof(TextEdit), FrameworkElement.GotFocusEvent, new RoutedEventHandler((s, e) => { ((TextEdit)s).SelectAll(); })); }

                                Thanks,
                                Nick
                                --------------------
                                Check if Search Engine is able to answer questions faster than I do!

                                0

                                Hi,

                                thank you for your code snippet, but this solution does not work for mouse interaction. it works only fine for the tab key.

                                it seems the text will selected for just a millisecond, afterwards the selection goes away. I think the selection will be set in the gotfocus-event and will get loss again while the mouse interaction is processed by the wpf.

                                0

                                Hi Stefan,

                                Selection is reset afterwards when the editor has already got focus and handles a mouse click. You can delay the SelectAll method call with the BeginInvoke method as shown below.

                                [C#]
                                public MainWindow() { InitializeComponent(); EventManager.RegisterClassHandler(typeof(TextEdit), FrameworkElement.GotFocusEvent, new RoutedEventHandler((s, e) => { TextEdit editor = (TextEdit)s; editor.Dispatcher.BeginInvoke(new SimpleDelegate(editor.SelectAll)); })); } delegate void SimpleDelegate();

                                Thanks,
                                Nick
                                --------------------
                                Check if Search Engine is able to answer questions faster than I do!

                                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, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

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