Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add AccessKeys to standard NavigationView elements
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
namespace InTheHand.UI.Xaml.Controls
public static class NavigationViewHelper
/// <summary>
/// Add standard access keys to the NavigationView control.
/// </summary>
/// <remarks>These are based on Microsoft Your Phone, there isn't a standard implementation across all NavigationView based apps.</remarks>
/// <param name="navigationView"></param>
public static void SetAccessKeys(this NavigationView navigationView)
// access key to show/hide navigation pane
navigationView.AccessKey = "H";
navigationView.KeyTipPlacementMode = KeyTipPlacementMode.Right;
// access key to open Settings item
var settingsItem = navigationView.SettingsItem as NavigationViewItem;
settingsItem.AccessKey = "S";
settingsItem.KeyTipPlacementMode = KeyTipPlacementMode.Right;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment