Share via


DesktopWindowXamlSource.GotFocus Event

Definition

Occurs when the DesktopWindowXamlSource gets focus in the desktop application (for example, the user presses the Tab key while focus is on the element just before the DesktopWindowXamlSource).

// Register
event_token GotFocus(TypedEventHandler<DesktopWindowXamlSource, DesktopWindowXamlSourceGotFocusEventArgs const&> const& handler) const;

// Revoke with event_token
void GotFocus(event_token const* cookie) const;

// Revoke with event_revoker
DesktopWindowXamlSource::GotFocus_revoker GotFocus(auto_revoke_t, TypedEventHandler<DesktopWindowXamlSource, DesktopWindowXamlSourceGotFocusEventArgs const&> const& handler) const;
public event TypedEventHandler<DesktopWindowXamlSource,DesktopWindowXamlSourceGotFocusEventArgs> GotFocus;
function onGotFocus(eventArgs) { /* Your code */ }
desktopWindowXamlSource.addEventListener("gotfocus", onGotFocus);
desktopWindowXamlSource.removeEventListener("gotfocus", onGotFocus);
- or -
desktopWindowXamlSource.ongotfocus = onGotFocus;
Public Custom Event GotFocus As TypedEventHandler(Of DesktopWindowXamlSource, DesktopWindowXamlSourceGotFocusEventArgs) 

Event Type

Remarks

When you add a DesktopWindowXamlSource to your desktop application, by default the DesktopWindowXamlSource does not automatically handle focus navigation via keyboard events such as the Tab or arrow keys. Call the NavigateFocus method to programmatically give focus when the user navigates to the DesktopWindowXamlSource.

Handle GotFocus event to be notified when user enters the DesktopWindowXamlSource via some non-keyboard event, such as a mouse click, and you want to keep the state of the UI in the host desktop application up to date.

Applies to