开发者

WPF Window set Focus

I have a WPF Window whi开发者_StackOverflowch I only create one time and then Show() and Hide() several times. Now I am searching a way to set the focus on a element on each Show(). Where and how can I do this?


Just call Element.Focus() on the element you want to focus.

If you mean bring focus to the window try calling window.Activate()


In WPF there are two main concepts that pertain to focus: keyboard focus and logical focus. Keyboard focus refers to the element that receives keyboard input and logical focus refers to the element in a focus scope that has focus. These concepts are discussed in detail in this overview.

You can probably write you own ShowHide method by including both Window.Show/Hide and element.Focus functionalities in order to handle both in the same method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜