InputFocusController.NavigateFocusRequested 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当 Content.ContentIsland 主机希望 ContentIsland 获取焦点时发生。
例如,用户已按 Tab 键浏览主机的元素,现在需要按 Tab 键进入 ContentIsland。 宿主应用程序在与 SiteBridge 关联的 InputFocusNavigationHost 上调用 InputFocusNavigationHost.NavigateFocus (Microsoft.UI.Input.FocusNavigationRequest) 。 然后,ContentIsland 的 InputFocusController 接收此 NavigateFocusRequested 事件,并可以决定是否获得焦点。
// Register
event_token NavigateFocusRequested(TypedEventHandler<InputFocusController, FocusNavigationRequestEventArgs const&> const& handler) const;
// Revoke with event_token
void NavigateFocusRequested(event_token const* cookie) const;
// Revoke with event_revoker
InputFocusController::NavigateFocusRequested_revoker NavigateFocusRequested(auto_revoke_t, TypedEventHandler<InputFocusController, FocusNavigationRequestEventArgs const&> const& handler) const;
public event TypedEventHandler<InputFocusController,FocusNavigationRequestEventArgs> NavigateFocusRequested;
function onNavigateFocusRequested(eventArgs) { /* Your code */ }
inputFocusController.addEventListener("navigatefocusrequested", onNavigateFocusRequested);
inputFocusController.removeEventListener("navigatefocusrequested", onNavigateFocusRequested);
- or -
inputFocusController.onnavigatefocusrequested = onNavigateFocusRequested;
Public Custom Event NavigateFocusRequested As TypedEventHandler(Of InputFocusController, FocusNavigationRequestEventArgs)
事件类型
注解
设置 FocusNavigationRequestEventArgs 的结果值不会隐式设置焦点。 必须显式调用 TrySetFocus。