SearchBoxControl has focus on app launching on Win8.1

*爱你&永不变心* 提交于 2019-12-05 19:44:59

Here's my guess. You are attempting to set focus to something else on the page, but there's actually nothing else on your page that can accept a programmatic focus. To test this, simply add a <Button /> to your page and set the focus to that. Buttons are perfect for this test, as would be a <TextBox />. If this foxes the problem then you understand it.

You have some options, and your choices will vary based on your app:

  1. Set the SearchBox to IsEnabled=false until the Page.Loaded is raised
  2. Set focus on another control, like a <Button /> that is Width="1" and Height="1"
  3. You might try TabStop="False" on the SearchBox, but that may not work
  4. Move the SearchBox further down the Logical Tree, the default Tab Stop is higher

Sorry for just brainstorming with you on this. I bet one of those will do it. Let me know.

Best of luck.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!