Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 1.91 KB

inputfocuscontroller_gotfocus.md

File metadata and controls

29 lines (19 loc) · 1.91 KB
-api-id -api-type
E:Microsoft.UI.Input.InputFocusController.GotFocus
winrt event

Microsoft.UI.Input.InputFocusController.GotFocus

-description

Occurs when the associated ContentIsland receives focus.

-remarks

A ContentIsland can receive focus through the TrySetFocus method, or because focus is moved from elsewhere. For example, an app using a DesktopChildSiteBridge to host content should signal that focus is to move to the content by calling SetFocus on the HWND of the bridge. The bridge internally will then move focus to the underlying HWND of the ContentIsland and the GotFocus event will be raised.

Note

If the top-level HWND of an app has focus and becomes inactive, focus will be lost and will not set back once the HWND is active again. Instead focus will be set to the top-level window that was activated and the HWND will not raise the GotFocus event (for example, if the user Alt+Tab navigates back to the app).

In this case, you need to manually set focus to the ContentIsland. The InputActivationListener supports events that can help determine when a window has been activated.

-see-also

InputFocusController.TrySetFocus, InputFocusController.HasFocus, InputFocusController.LostFocus

-examples