开发者

Programmatically move Cursor to a TextBlock

in my application I'm opening a Window as a dialog. Inside this win开发者_开发知识库dow, there's a TextBox called "myText". When the dialog is shown, I want the cursor to be automatically inside the "myText" TextBox, so the user can immediately enter something without having to click in the TextBox. I however have problems realising this, can somebody please help me with this? Thank you very much for any hint!


Set the FocusManager.FocusedElement property on your Window:

FocusManager.FocusedElement="{Binding ElementName=myText}"


Or myText.Focus() in your Loaded event

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜