DesktopWindowXamlSource.GotFocus イベント

定義

DesktopWindowXamlSource がデスクトップ アプリケーションでフォーカスを取得したときに発生します (DesktopWindowXamlSource の直前の要素にフォーカスがあるときにユーザーが Tab キーを押したときなど)。

// 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) 

イベントの種類

注釈

DesktopWindowXamlSource をデスクトップ アプリケーションに追加すると、既定では、DesktopWindowXamlSourceTab キーや方向キーなどのキーボード イベントによるフォーカス ナビゲーションを自動的に処理しません。 NavigateFocus(Microsoft.UI.Xaml.Hosting.XamlSourceFocusNavigationRequest) メソッドを呼び出して、ユーザーが DesktopWindowXamlSource に移動したときにプログラムでフォーカスを設定します。

ユーザーがキーボード以外のイベント (マウス クリックなど) を使用して DesktopWindowXamlSource に入ったときに通知を受け取る GotFocus イベントを処理し、ホスト デスクトップ アプリケーションの UI の状態を最新の状態に保ちます。

適用対象