WPF Window set Focus

BennoDual picture BennoDual · Jun 18, 2011 · Viewed 36.3k times · Source

I have a WPF Window which 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?

Answer

Cilvic picture Cilvic · Jun 18, 2011

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

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