KeyboardNavigation 類別

定義

提供可焦點化物件之間的邏輯巡覽和方向式巡覽。Provides logical and directional navigation between focusable objects.

public ref class KeyboardNavigation sealed
public sealed class KeyboardNavigation
type KeyboardNavigation = class
Public NotInheritable Class KeyboardNavigation
繼承
KeyboardNavigation

範例

下列範例會建立Menu具有多個MenuItem物件的。The following example creates a Menu with a number of MenuItem objects. 附加屬性在上Cycle Menu設定為。 TabNavigationThe TabNavigation attached property is set to Cycle on the Menu. 這表示當焦點在中Menu使用 tab 鍵變更時, 焦點會從每個專案移動, 而當到達最後一個專案時, 焦點會回到第一個元素。This means that when focus is changed using the tab key within the Menu, focus will move from each element and when the last element is reached focus will return to the first element.

<Menu KeyboardNavigation.TabNavigation="Cycle">
  <MenuItem Header="Menu Item 1" />
  <MenuItem Header="Menu Item 2" />
  <MenuItem Header="Menu Item 3" />
  <MenuItem Header="Menu Item 4" />
</Menu>
Menu navigationMenu = new Menu();
MenuItem item1 = new MenuItem();
MenuItem item2 = new MenuItem();
MenuItem item3 = new MenuItem();
MenuItem item4 = new MenuItem();

navigationMenu.Items.Add(item1);
navigationMenu.Items.Add(item2);
navigationMenu.Items.Add(item3);
navigationMenu.Items.Add(item4);

KeyboardNavigation.SetTabNavigation(navigationMenu, 
    KeyboardNavigationMode.Cycle);
Dim navigationMenu As New Menu()
Dim item1 As New MenuItem()
Dim item2 As New MenuItem()
Dim item3 As New MenuItem()
Dim item4 As New MenuItem()

navigationMenu.Items.Add(item1)
navigationMenu.Items.Add(item2)
navigationMenu.Items.Add(item3)
navigationMenu.Items.Add(item4)

KeyboardNavigation.SetTabNavigation(navigationMenu, KeyboardNavigationMode.Cycle)

備註

KeyboardNavigation按下其中一個導覽鍵時, 類別會負責執行預設的鍵盤焦點導覽。The KeyboardNavigation class is responsible for implementing default keyboard focus navigation when one of the navigation keys is pressed. 導覽鍵如下:Tab、Shift + Tab、Ctrl + Tab、Ctrl + Shift + Tab、向上箭號、Download-downarrow-circled、LeftArrow 和 RightArrow keys。The navigation keys are: Tab, Shift+Tab, Ctrl+Tab, Ctrl+Shift+Tab, UpArrow, DownArrow, LeftArrow, and RightArrow keys.

邏輯導覽的範例是使用 tab 鍵移動焦點。An example of logical navigation is using the tab key to move focus.

方向導覽的範例是使用方向鍵來移動焦點。An example of directional navigation is using the arrow keys to move focus.

欄位

AcceptsReturnProperty

識別 AcceptsReturn 附加屬性。Identifies the AcceptsReturn attached property.

ControlTabNavigationProperty

識別 ControlTabNavigation 附加屬性。Identifies the ControlTabNavigation attached property.

DirectionalNavigationProperty

識別 DirectionalNavigation 附加屬性。Identifies the DirectionalNavigation attached property.

IsTabStopProperty

識別 IsTabStop 附加屬性。Identifies the IsTabStop attached property.

TabIndexProperty

識別 TabIndex 附加屬性。Identifies the TabIndex attached property.

TabNavigationProperty

識別 TabNavigation 附加屬性。Identifies the TabNavigation attached property.

附加屬性

AcceptsReturn

取得或設定值,指出控制項是否接受 Return 字元。Gets or sets a value indicating whether the Return character is accepted by a control.

ControlTabNavigation

取得或設定有設定此屬性之項目子系的邏輯控制項定位巡覽行為。Gets or sets the logical control tab navigation behavior for the children of the element that this property is set on.

DirectionalNavigation

取得或設定有設定此屬性之項目子系的方向式巡覽行為。Gets or sets the directional navigation behavior for the children of the element that this property is set on.

IsTabStop

取得或設定值,指出有設定這個屬性的項目是否為定位停駐點。Gets or sets a value indicating whether the element that this property is set on is a tab stop.

TabIndex

取得或設定有設定這個屬性之項目的定位點索引。Gets or sets the tab index for the element that this property is set on.

TabNavigation

取得或設定有設定此屬性之項目其子系的邏輯定位巡覽行為。Gets or sets the logical tab navigation behavior for the children of the element that this property is set on.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetAcceptsReturn(DependencyObject)

針對指定的項目,取得 AcceptsReturn 附加屬性的值。Gets the value of the AcceptsReturn attached property for the specified element.

GetControlTabNavigation(DependencyObject)

針對指定的項目,取得 ControlTabNavigation 附加屬性的值。Gets the value of the ControlTabNavigation attached property for the specified element.

GetDirectionalNavigation(DependencyObject)

針對指定的項目,取得 DirectionalNavigation 附加屬性的值。Gets the value of the DirectionalNavigation attached property for the specified element.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetIsTabStop(DependencyObject)

針對指定的項目,取得 IsTabStop 附加屬性的值。Gets the value of the IsTabStop attached property for the specified element.

GetTabIndex(DependencyObject)

針對指定的項目,取得 TabIndex 附加屬性的值。Gets the value of the TabIndex attached property for the specified element.

GetTabNavigation(DependencyObject)

針對指定的項目,取得 TabNavigation 附加屬性的值。Gets the value of the TabNavigation attached property for the specified element.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
SetAcceptsReturn(DependencyObject, Boolean)

設定指定之項目的 AcceptsReturn 附加屬性值。Sets the value of the AcceptsReturn attached property for the specified element.

SetControlTabNavigation(DependencyObject, KeyboardNavigationMode)

設定指定之項目的 ControlTabNavigation 附加屬性值。Sets the value of the ControlTabNavigation attached property for the specified element.

SetDirectionalNavigation(DependencyObject, KeyboardNavigationMode)

設定指定之項目的 DirectionalNavigation 附加屬性值。Sets the value of the DirectionalNavigation attached property for the specified element.

SetIsTabStop(DependencyObject, Boolean)

設定指定之項目的 IsTabStop 附加屬性值。Sets the value of the IsTabStop attached property for the specified element.

SetTabIndex(DependencyObject, Int32)

取得指定項目上的 TabIndex 附加屬性值。Set the value of the TabIndex attached property for the specified element.

SetTabNavigation(DependencyObject, KeyboardNavigationMode)

設定指定之項目的 TabNavigation 附加屬性值。Sets the value of the TabNavigation attached property for the specified element.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於

另請參閱