AppBarButton.KeyboardAcceleratorTextOverride AppBarButton.KeyboardAcceleratorTextOverride AppBarButton.KeyboardAcceleratorTextOverride AppBarButton.KeyboardAcceleratorTextOverride Property


Gets or sets a string that overrides the default key combination string associated with a keyboard accelerator.

Example of a menu showing keyboard accelerators for various menu items
Example of a menu showing keyboard accelerators for various menu items

public : Platform::String KeyboardAcceleratorTextOverride { get; set; }
winrt::hstring KeyboardAcceleratorTextOverride();

void KeyboardAcceleratorTextOverride(winrt::hstring keyboardacceleratortextoverride);
public string KeyboardAcceleratorTextOverride { get; set; }
Public ReadWrite Property KeyboardAcceleratorTextOverride As string

Property Value

string string

The string to replace the default key combination string. The default is null.

Use a single space for no text.

Additional features and requirements

Device family
Windows 10, version 1803 (introduced v10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)


Windows 10, version 1703, introduced keyboard accelerator shortcuts. However, these shortcuts were not displayed with the UI of their corresponding controls.

Starting with Windows 10, version 1803, when KeyboardAccelerators are declared, controls display the corresponding key combinations by default.

The override text is not be presented if the system cannot detect an attached keyboard (you can check this yourself through the KeyboardPresent property).

Version compatibility

The KeyboardAcceleratorTextOverride property is not available prior to Windows 10, version 1803. If your app’s 'minimum platform version' setting in Microsoft Visual Studio is less than the 'introduced version' shown in the Requirements block later in this page, you must design and test your app to account for this. For more info, see Version adaptive code.

To avoid exceptions when your app runs on previous versions of Windows 10, do not set this property in XAML or use it without performing a runtime check. This example shows how to use the ApiInformation class to check for the presence of this property before you set it.

<CommandBar x:Name="commandBar1" Loaded="CommandBar_Loaded">
    <AppBarButton x:Name="appBarButtonCut" Icon="Cut" Label="Cut"/>
private void CommandBar_Loaded(object sender, RoutedEventArgs e)
    if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.AppBarButton", "KeyboardAcceleratorTextOverride"))
        appBarButtonCut.KeyboardAcceleratorTextOverride = "Ctrl+C";

See also