Skip to content

Menu key accelerators #1634

@davidbritch

Description

@davidbritch

.NET MAUI 8 includes keyboard accelerators for menu items. Keyboard accelerators enable you to assign keyboard shortcuts to any menu item, whether visible or not, and attach them to any UI element.

<ContentPage.MenuBarItems>
    <MenuBarItem Text="File">
        <MenuFlyoutItem Text="Preferences"
            Command="{Binding PreferencesCommand}"
        />
    </MenuBarItem>
    <MenuBarItem Text="Products">
        <MenuFlyoutItem 
            x:Name="AddProductMenu"
            Text="Add Product"
            Command="{Binding AddProductCommand}"
        />
        <MenuBarItem Text="Add Product Category"/>
    </MenuBarItem>
</ContentPage.MenuBarItems>
MenuItem.SetAccelerator(AddProductMenu, Accelerator.FromString("Ctrl+A"));

dotnet/maui#14740

See dotnet/maui#16740 for the refactored API.


Associated WorkItem - 164932

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 10Work items for the .NET 10 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.doc-enhancementImprove the current content [org]

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions