KeyboardNavigation.TabNavigation 附加属性

定义

获取设置此属性所在元素的子级的逻辑 Tab 键导航行为或对该行为进行设置。Gets or sets the logical tab navigation behavior for the children of the element that this property is set on.

see GetTabNavigation, and SetTabNavigation
see GetTabNavigation, and SetTabNavigation
see GetTabNavigation, and SetTabNavigation

示例

下面的示例创建一个 Menu 具有多个 MenuItem 对象的。The following example creates a Menu with a number of MenuItem objects. TabNavigation 上,附加属性设置为 Cycle MenuThe TabNavigation attached property is set to Cycle on the Menu. 这意味着,当使用中的 tab 键更改焦点时 Menu ,焦点将从每个元素移动,当到达最后一个元素时,焦点将返回到第一个元素。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)

注解

选项卡导航通过使用 TAB 键调用。Tab navigation is invoked by using the TAB key.

依赖项属性信息Dependency Property Information

标识符字段Identifier field TabNavigationProperty
元数据属性设置为 trueMetadata properties set to true None

适用于

另请参阅