InputFocusController 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示物件,該物件支持 處理和管理 ContentIsland 上的焦點事件。
public ref class InputFocusController sealed : InputObject
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65540)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InputFocusController final : InputObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65540)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InputFocusController : InputObject
Public NotInheritable Class InputFocusController
Inherits InputObject
- 繼承
- 屬性
備註
ContentIsland 具有基礎 HWND ,可與 Win32 API 互動,並接收 Win32 訊息 (,例如各種輸入訊息) 。
如果 ContentIsland 的基礎 HWND 具有 Win32 焦點,ContentIsland 會有焦點。
當 ContentIsland 有焦點時,它會從系統接收鍵盤輸入訊息。 鍵盤輸入事件可由 InputKeyboardSource 物件處理,該對像是透過 InputKeyboardSource.GetForIsland (Microsoft.UI.Content.ContentIsland) 方法擷取。
處置時的行為
InputFocusController 與特定的 ContentIsland 相關聯。 如果處置 InputFocusController,則會失去該關聯,而且所有事件處理程式都會取消註冊。
如果處置相關聯的 ContentIsland ,則也會處置相關聯的 InputFocusController。
如需詳細資訊,請參閱 Microsoft.UI.Input.InputObject。
執行緒模型
InputFocusController 只能來自建立它的線程。 不同線程上的任何屬性存取或函數調用都會傳回RPC_E_WRONG_THREAD (或对等的投影错误类型) 。
如需詳細資訊,請參閱 Microsoft.UI.Input.InputObject。
屬性
DispatcherQueue |
取得 InputObject 的 DispatcherQueue 。 (繼承來源 InputObject) |
HasFocus |
取得相關聯的 ContentIsland 是否具有焦點。 |
方法
DepartFocus(FocusNavigationRequest) |
引發 Content.ContentIsland 主機的 InputFocusNavigationHost.DepartFocusRequested 事件。 例如,使用者已索引標籤處理 ContentIsland 內的所有可索引標籤專案,現在焦點應該從 Island 移出主控應用程式中的其他專案。 |
GetForIsland(ContentIsland) |
InputFocusController擷取指定 ContentIsland 的物件。 |
TrySetFocus() |
嘗試將焦點設定為與 InputFocusController 相關聯的 ContentIsland 。 |
事件
GotFocus |
發生於相關聯的 ContentIsland 收到焦點時。 |
LostFocus |
當焦點從相關聯的 ContentIsland 移動時發生。 |
NavigateFocusRequested |
發生於 Content.ContentIsland 主機想要 ContentIsland 取得焦點時。 例如,使用者已透過主機的元素進行索引標籤,現在必須索引標籤到 ContentIsland。 主控應用程式會在與 SiteBridge 相關聯的 InputFocusNavigationHost 上呼叫 InputFocusNavigationHost.NavigateFocus (Microsoft.UI.Input.FocusNavigationRequest) 。 ContentIsland 的 InputFocusController 接著會收到此 NavigateFocusRequested 事件,並可以決定是否要取得焦點。 |
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應