textbox - select all
-
I know it sounds stupid but i'm looking for a way to style a textbox so that when it has focus it selects all the text. I know I could just call 'textBox.SelectAll()' (but i like to avoid x:Name). I could subclass the textbox and override OnFocus and call "SelectAll()" (but i don't like the idea). I'd really like to be able to do this in xaml by creating a style. I did a google check but came up empty :( EDIT: i just came across this solution[^]. I'm really hoping for a pure xaml solution but this will work.
Don't be overcome by evil, but overcome evil with good
-
I know it sounds stupid but i'm looking for a way to style a textbox so that when it has focus it selects all the text. I know I could just call 'textBox.SelectAll()' (but i like to avoid x:Name). I could subclass the textbox and override OnFocus and call "SelectAll()" (but i don't like the idea). I'd really like to be able to do this in xaml by creating a style. I did a google check but came up empty :( EDIT: i just came across this solution[^]. I'm really hoping for a pure xaml solution but this will work.
Don't be overcome by evil, but overcome evil with good
This is what I use in all my applications. http://www.madprops.org/blog/wpf-textbox-selectall-on-focus/[^]
Cheers, Karl
» CodeProject 2008 MVP, CodeProject 2009 MVP My Blog | Mole's Home Page | XAML Power Toys Home PageJust a grain of sand on the worlds beaches.