C# Class PhotoSharingApp.Universal.Controls.NavMenuListView

A specialized ListView to represent the items in the navigation menu.
This class handles the following: 1. Sizes the panel that hosts the items so they fit in the hosting pane. Otherwise, the keyboard may appear cut off on one side b/c the Pane clips instead of affecting layout. 2. Provides a single selection experience where keyboard focus can move without changing selection. Both the 'Space' and 'Enter' keys will trigger selection. The up/down arrow keys can move keyboard focus without triggering selection. This is different than the default behavior when SelectionMode == Single. The default behavior for a ListView in single selection requires using the Ctrl + arrow key to move keyboard focus without triggering selection. Users won't expect this type of keyboarding model on the nav menu.
Inheritance: Windows.UI.Xaml.Controls.ListView
Mostrar archivo Open project: Microsoft/Appsample-Photosharing

Public Methods

Method Description
NavMenuListView ( ) : System
SetSelectedItem ( ListViewItem item ) : void

Mark the item as selected and ensures everything else is not. If the item is null then everything is unselected.

Protected Methods

Method Description
OnApplyTemplate ( ) : void
OnKeyDown ( KeyRoutedEventArgs e ) : void

Custom keyboarding logic to enable movement via the arrow keys without triggering selection until a 'Space' or 'Enter' key is pressed.

Private Methods

Method Description
InvokeItem ( object focusedItem ) : void
ItemClickedHandler ( object sender, ItemClickEventArgs e ) : void
OnPaneToggled ( ) : void

Re-size the ListView's Panel when the SplitView is compact so the items will fit within the visible space and correctly display a keyboard focus rect.

TryMoveFocus ( FocusNavigationDirection direction ) : void

This method is a work-around until the bug in FocusManager.TryMoveFocus is fixed.

Method Details

NavMenuListView() public method

public NavMenuListView ( ) : System
return System

OnApplyTemplate() protected method

protected OnApplyTemplate ( ) : void
return void

OnKeyDown() protected method

Custom keyboarding logic to enable movement via the arrow keys without triggering selection until a 'Space' or 'Enter' key is pressed.
protected OnKeyDown ( KeyRoutedEventArgs e ) : void
e Windows.UI.Xaml.Input.KeyRoutedEventArgs The event arguments.
return void

SetSelectedItem() public method

Mark the item as selected and ensures everything else is not. If the item is null then everything is unselected.
public SetSelectedItem ( ListViewItem item ) : void
item Windows.UI.Xaml.Controls.ListViewItem The item to select.
return void