How Do I Give a Textbox Focus in Silverlight?

前端 未结 15 1785
無奈伤痛
無奈伤痛 2020-12-01 07:49

In my Silverlight application, I can\'t seem to bring focus to a TextBox control. On the recommendation of various posts, I\'ve set the IsTabStop property to True and I\'m

15条回答
  •  清歌不尽
    2020-12-01 08:26

    Indeed an annoying beheviour. I found a simple straightforward solution:

    (VB code)

        Me.Focus()
        Me.UpdateLayout()
    
        Me.tbx_user_num.Focus()
        Me.tbx_user_num.UpdateLayout()
    

    Each element here is essential, as per my project at least (VB2010 SL4 OutOfBrowser).

    Credit to : http://www.dotnetspark.com/kb/1792-set-focus-to-textbox-silverlight-3.aspx

提交回复
热议问题