Yuf
Yuf

Reputation: 610

Is there a way to set Keyboard.FocusedElement to a specific element?

Keyboard.FocusedElement gives the element that has keyboard focus. However it has no setter. I want to set this property to another element through code. is there a way?

On microsoft's site, it said this: "Keyboard focus refers to the object that is receiving keyboard input. The element with keyboard focus has IsKeyboardFocused set to true."

However IsKeyboardFocused also has no setter as well.

Upvotes: 2

Views: 1114

Answers (1)

Egor
Egor

Reputation: 1660

I think you are just looking for the UIElement.Focus() method.

Upvotes: 3

Related Questions