As Microsoft moves closer to general availability of its .NET MAUI (Multi-platform App UI) cross-platform development framework, the vendor has just added a menu capability for desktop developers.
Preview 14 of .NET MAUI, featured in Visual Studio 2022 17.2 Preview as of March 16, features a MenuBar to meet the need for a traditional menu at the top of the app window on Windows and in the title bar on MacOS.
Menus may be expressed in XAML or in C# for any
ContentPage hosted in
Shell or a
NavigationPage. Developers can begin by adding a
MenuBarItem to the page’s
MenuBarItems collection and adding
MenuFlyoutItem for direct children or
MenuFlyoutSubItem for containers of other
An evolution of the Xamarin.Forms cross-platform framework, .NET MAUI enables development of native and mobile desktop apps with C# and XAML.
Leveraging a single, shared code base, apps can run on Android, iOS, Windows, and MacOS. With .NET MAUI, APIs for the different platforms are united into a single API enabling a write-once, run-anywhere developer experience with access to native platforms.
A release candidate of .NET MAUI is due in April, with general availability by June. Once the production release of .NET MAUI ships with.NET 6 and Visual Studio, the focus will shift to tasks pertinent to a planned .NET 7 release later this year. To access the preview, install the Visual Studio 2022 preview and confirm .NET MAUI (preview) is checked under the “Mobile Development with .NET Workload.”
Other highlights of Preview 14, which offers issue resolutions and completed features, include device and Essentials reconciliation which was added, along with interfaces for Essentials APIs.
Meanwhile, the Shell WinUI implementation was moved over to reuse most of the same components as a non-Shell app. This enables iterating on the rest of the Shell APIs in a more collaborative way, which can apply to non-Shell structures.
Other updates include news that iOS image caching is being implemented, alongside handlers being created for shapes such as lines and rectangles and the cookies property now implemented in WebView.