I'm using a WPF TextBox, and I'm calling the Select()
method to make a selection. Unfortunately, it doesn't seem to work unless I select something manually first. Can someone suggest as to why it happens?
views:
1182answers:
1
+3
A:
Does your textbox have focus when you call the Select method?
The selection will not show unless it has focus, but the common way for the textbox to get focus is by clicking on it...which deselects the text. This behaviour could give the impression that it's not working.
Calling TextBox.Focus() after (or before) calling Select() should fix it.
Bubblewrap
2009-01-28 17:41:55
Why aren't those things in the Select documentation? It would keep alot of frustrations from beginners like me.
Elazar Leibovich
2009-09-13 11:52:07