.NET MAUI

Desktop - WinUI & Mac Catalyst

6 question(s)

How does MAUI target Windows and macOS?

Beginner
MAUI runs on Windows via WinUI 3 (Windows App SDK) and on macOS via Mac Catalyst (running the iOS UIKit stack on the Mac). One codebase produces desktop apps alongside mobile, though desktop adds concerns like resizable windows, menus, and pointer/keyboard input.
Real-world example A productivity app ships to the Microsoft Store (WinUI) and the Mac App Store (Catalyst) from the same MAUI project.

Common follow-ups: What renders Windows UI? | What is Mac Catalyst based on?

Windows macOS Desktop - WinUI & Mac Catalyst

How do you adapt UI for desktop vs mobile in MAUI?

Intermediate
Use DeviceInfo.Idiom/OnIdiom to branch layout, provide larger hit targets and multi-column layouts on desktop, add menus (MenuBarItems) and keyboard accelerators, and handle window resizing with responsive Grids. Test pointer hover states, which don't exist on touch.
<ContentPage.MenuBarItems>
    <MenuBarItem Text="File">
        <MenuFlyoutItem Text="New" Command="{Binding NewCommand}" />
    </MenuBarItem>
</ContentPage.MenuBarItems>
Real-world example The desktop build gains a File menu and a two-pane layout, while phones keep a single-column stacked UI.

Common follow-ups: How do you add a menu bar? | What input differs on desktop?

Responsive UI Windows Desktop - WinUI & Mac Catalyst

How do you handle keyboard shortcuts and pointer interactions on desktop?

Intermediate
Add KeyboardAccelerators to menu items or use platform key handling, and use PointerGestureRecognizer for hover/enter/exit/pointer-moved events to build hover states and tooltips. These enrich desktop UX where a mouse and physical keyboard are present.
<Button Text="Save">
    <Button.GestureRecognizers>
        <PointerGestureRecognizer PointerEntered="OnHover" />
    </Button.GestureRecognizers>
</Button>
Real-world example Toolbar buttons show hover highlights and Ctrl+S triggers save on desktop via accelerators and pointer gestures.

Common follow-ups: What is PointerGestureRecognizer? | How do you bind Ctrl+S?

Gestures Windows Desktop - WinUI & Mac Catalyst

How do you access native Windows (WinUI) APIs from MAUI?

Advanced
Guard code with #if WINDOWS and use the Windows App SDK/WinRT APIs, reaching the native control via Handler.PlatformView (a WinUI element). You can also add Windows-specific packages. Keep such code in Platforms/Windows or partial classes to isolate it.
#if WINDOWS
var native = (Microsoft.UI.Xaml.Controls.Button)button.Handler.PlatformView;
native.CornerRadius = new Microsoft.UI.Xaml.CornerRadius(12);
#endif
Real-world example A Windows build applies a WinUI-specific corner radius by reaching the native button through its handler.

Common follow-ups: Where does Windows-only code live? | What is the native type for a Button on Windows?

Platform Integration Windows Desktop - WinUI & Mac Catalyst

What are common desktop-specific challenges when shipping MAUI apps?

Intermediate
Handle window sizing/min-size and persistence, multi-window scenarios, menus and shortcuts, file dialogs (via FilePicker/FolderPicker), high-DPI scaling, and different app lifecycle (no 'background kill' like mobile). Also account for store packaging differences (MSIX for Windows, notarization for macOS).
// Set an initial/minimum window size (Windows)
window.Width = 1200; window.Height = 800;
window.MinimumWidth = 800;
Real-world example A desktop app remembers and restores its window size and enforces a sensible minimum so layouts don't break.

Common follow-ups: How do you pick files on desktop? | What packaging does Windows use?

Windows Deployment Desktop - WinUI & Mac Catalyst

How do you notarize and distribute a MAUI Mac Catalyst app?

Advanced
Build a signed .app/.pkg with a Developer ID or Mac App Store certificate, then notarize with Apple's notary service (for direct distribution) or submit to the Mac App Store. Entitlements and provisioning must match the distribution channel. CI on macOS automates archive, sign, notarize, and upload.
dotnet publish -f net8.0-maccatalyst -c Release \
  -p:CreatePackage=true -p:EnablePackageSigning=true
Real-world example A Mac build is signed, notarized, and stapled so users can install it without Gatekeeper warnings.

Common follow-ups: What is notarization for? | How does Mac App Store distribution differ?

macOS Deployment Desktop - WinUI & Mac Catalyst