CoreInputView 類別

定義

可讓應用程式控制停駐、未模擬、可移動或轉移輸入窗格的顯示 (和相關聯的 UI) 、在窗格移動、顯示或隱藏時接收通知,以及判斷窗格視窗的哪個部分被窗格遮蔽。

注意

HoloLens 不支援。

public ref class CoreInputView sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class CoreInputView final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CoreInputView final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class CoreInputView
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class CoreInputView
Public NotInheritable Class CoreInputView
繼承
Object Platform::Object IInspectable CoreInputView
屬性

Windows 需求

裝置系列
Windows 10 Fall Creators Update (已於 10.0.16299.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v5.0 引進)

備註

主要檢視是指 CoreInputViewKind.KeyboardCoreInputViewKind.Handwriting 檢視,而 CoreInputView 可以是 CoreInputViewKind.Handwriting的任何值。

由架構 (使用,例如 XAML) 或自訂文字控制項。

您的應用程式可以使用此物件公開的資訊來調整並重排其 UI,以考慮任何遮蔽。

CoreInputView API 支援下列類型的輸入窗格。

  • 固定的軟輸入面板 (SIP) ,例如 觸控式鍵盤和手寫面板 ,通常是您的應用程式 UI 重排。
  • 浮動工具列或 SIP – 通常您的應用程式 UI 不會重排。
  • 重迭面板,例如內嵌筆跡或輸入法候選視窗 – 通常您的應用程式 UI 不會針對編輯控制項進行重排,但會針對文字/搜尋建議進行重排。

當使用者執行需要他們提供資訊的動作時,會出現輸入窗格,例如輸入文字欄位。

根據預設,Windows 會處理輸入窗格事件並重新置放內容,讓使用者可以看到具有焦點的控制項。 如果您在應用程式中將 CoreTextEditCoNtext.InputPaneDisplayPolicy 設定為 Manual ,您必須負責使用 TryShowPrimaryViewTryHidePrimaryView來顯示和隱藏輸入窗格。 使用此類別覆寫預設行為,並自訂輸入窗格。

呼叫 GetForCurrentView 以取得 CoreInputView 物件。

註冊以接收輸入窗格通知之後,每當顯示窗格或隱藏 在呼叫 GetForCurrentView 方法時,系統就會呼叫事件委派。

注意

這個類別不是敏捷式的,這表示您需要考慮其執行緒模型和封送處理行為。 如需詳細資訊,請參閱 執行緒和封送處理 (C++/CX)

版本歷程記錄

Windows 版本 SDK 版本 已新增值
1803 17134 TryTransferXYFocusToPrimaryView
1803 17134 XYFocusTransferredToPrimaryView
1803 17134 XYFocusTransferringFromPrimaryView
1809 17763 TryHide
1809 17763 TryShow
1809 17763 TryShow (CoreInputViewKind)
1903 18362 GetForUICoNtext
2004 19041 PrimaryViewHiding
2004 19041 PrimaryViewShowing

方法

GetCoreInputViewOcclusions()

擷取目前遮蔽應用程式之每個輸入窗格的參考。

GetForCurrentView()

擷取與目前視窗相關聯的 CoreInputView 物件。

GetForUIContext(UIContext)

取得與具有指定內容識別碼之檢視相關聯的 CoreInputView 物件。

IsKindSupported(CoreInputViewKind)

取得是否支援指定的 CoreInputView 類型。

TryHide()

如果) 與 CoreInputView 窗格相關聯的輸入窗格,嘗試隱藏 (。

TryHidePrimaryView()

如果) 與 CoreInputView相關聯的輸入窗格,嘗試隱藏 (。

TryShow()

如果隱藏) 與 CoreInputView相關聯的輸入窗格,則嘗試顯示 (。

TryShow(CoreInputViewKind)

如果隱藏) 與CoreInputView相關聯的指定輸入窗格類型,則嘗試顯示 (。

TryShowPrimaryView()

嘗試在 CoreInputView 窗格) 隱藏時顯示 (。

此方法是「最佳努力」,而且保證使用者能夠與焦點控制項互動。 針對停駐的軟輸入面板 (SIP) ,例如 觸控式鍵盤和手寫面板,只有在硬體鍵盤無法使用時,才會顯示窗格。

TryTransferXYFocusToPrimaryView(Rect, CoreInputViewXYFocusTransferDirection)

嘗試將焦點從應用程式 UI 移至輸入窗格。

事件

OcclusionsChanged

發生于一或多個 CoreInputViewOcclusion 物件變更其位置或遮蔽區域,以回應與 CoreInputView相關聯的輸入窗格重新置放時。

PrimaryViewAnimationStarting

應用程式中發生的動畫,回應 CoreInputView 主要檢視的顯示或隱藏。

PrimaryViewHiding

發生于與 CoreInputView 相關聯的輸入窗格在可見) 時隱藏 (。

PrimaryViewShowing

如果隱藏) ,則會在與 CoreInputView 相關聯的輸入窗格顯示之前發生 (。

SupportedKindsChanged

發生于CoreInputView 支援的 CoreInputViewKind檢視集合變更時。

XYFocusTransferredToPrimaryView

當焦點從應用程式 UI 移至輸入窗格時發生。

XYFocusTransferringFromPrimaryView

發生在輸入窗格失去焦點之前,以及 UI 元素取得焦點之前。

適用於

另請參閱