Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 4
 KeyboardNavigationMode Enumeration
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2010/.NET Framework 4

Other versions are also available for the following:
.NET Framework Class Library
KeyboardNavigationMode Enumeration

Specifies the possible values for changes in focus when logical and directional navigation occurs.

Namespace:  System.Windows.Input
Assembly:  PresentationFramework (in PresentationFramework.dll)
Visual Basic
Public Enumeration KeyboardNavigationMode
C#
public enum KeyboardNavigationMode
Visual C++
public enum class KeyboardNavigationMode
F#
type KeyboardNavigationMode
XAML Attribute Usage
<object property="enumerationMemberName" .../>
Member nameDescription
ContinueEach element receives keyboard focus, as long as it is a navigation stop. Navigation leaves the containing element when an edge is reached.
OnceThe container and all of its child elements as a whole receive focus only once. Either the first tree child or the or the last focused element in the group receives focus
CycleDepending on the direction of the navigation, the focus returns to the first or the last item when the end or the beginning of the container is reached. Focus cannot leave the container using logical navigation.
NoneNo keyboard navigation is allowed inside this container.
ContainedDepending on the direction of the navigation, focus returns to the first or the last item when the end or the beginning of the container is reached, but does not move past the beginning or end of the container.
LocalTab Indexes are considered on local subtree only inside this container and behave like Continue after that.

The following example creates a Menu with a number of MenuItem objects. The TabNavigation attached property is set to Cycle on the 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.

XAML
<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>
Visual Basic
            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)
C#
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);

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker