Difference between KeyboardNavigationMode Contained and Cycle?

Jefim picture Jefim · Dec 9, 2010 · Viewed 7.1k times · Source

Short question - what is the real difference put in easy and understandable words?..

Extracts from MSDN:

  • Contained - Depending 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.
  • Cycle - Depending 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.

The difference is in the last part of the description of those modes. But I cannot understand it. Can anyone explain it in a more humane way?

Answer

biju picture biju · Dec 9, 2010

The KeyboardNavigation class defines three attached properties that allow the modification of each of the navigation modes:

KeyboardNavigation.TabNavigation, KeyboardNavigation.DirectionalNavigation, KeyboardNavigation.ControlTabNavigation

Each of these properties defines six possible values.These values specifies how the navigation can be done in a list control(eg:ListBox,listview)

for instance;

KeyboardNavigation.DirectionalNavigation="Contained"

is used to indicate that when i press the down or up arrow in the keyboard to navigate between items in a list,the navigation stops at the last item or first item,then we have to use the opposite button to navigate further up or down.

KeyboardNavigation.DirectionalNavigation="Cycle"

is used to indicate that when i press the down or up arrow in the keyboard to navigate between items in a list,the navigation continues from the top or bottom item in a cyclic manner

same is the case with TabNavigation which indicate the navigation mode when we press the tab button in a list