GettingFocusEventArgs 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供 FocusManager.GettingFocus 與 UIElement.GettingFocus 事件的資料。
public ref class GettingFocusEventArgs sealed : RoutedEventArgs
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class GettingFocusEventArgs final : RoutedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class GettingFocusEventArgs : RoutedEventArgs
Public NotInheritable Class GettingFocusEventArgs
Inherits RoutedEventArgs
- 繼承
- 屬性
備註
一次只能對一個 UI 元素進行聚焦。
當另一個控制項失去焦點、應用程式視圖改變、使用者切換應用程式,或使用者與系統互動使該應用程式不再處於前景時,控制器可能會獲得焦點。
屬性
| 名稱 | Description |
|---|---|
| Cancel |
是否應該取消對焦導航。 |
| CorrelationId |
當焦點移動事件啟動時,會取得唯一產生的ID。 |
| Direction |
它能讓應用程式介面中,焦點從一個元素轉移到另一個元素。 |
| FocusState |
取得元素獲得焦點的輸入模式。 |
| Handled |
取得或設定一個值,標記路由事件為已處理。 值 |
| InputDevice |
取得接收輸入事件的輸入裝置類型。 |
| NewFocusedElement |
取得或設定最近聚焦的物件。 |
| OldFocusedElement |
拿到最後一個聚焦的物件。 |
| OriginalSource |
會得到一個指向引發事件的物件的參考。 這通常是控制項中的範本部分,而非你應用程式介面中聲明的元素。 (繼承來源 RoutedEventArgs) |
方法
| 名稱 | Description |
|---|---|
| TryCancel() |
嘗試取消正在進行的專注動作。 |
| TrySetNewFocusedElement(DependencyObject) |
嘗試將焦點轉向指定元素,而非原本的目標元素。 |