fix #136 - Wire native navigation and add titlebar buttons#137
Merged
Conversation
Expose native-to-Blazor navigation on the toolbar service and hook it up in the main layout, plus add Doctor and Settings buttons to the Windows title bar. Details: - IToolbarService: added NavigationRequested event and RequestNavigation(string) API to request navigation from native UI. - ToolbarService: implemented the event and RequestNavigation invocation. - MainLayout.razor: subscribes/unsubscribes to ToolbarService.NavigationRequested on Windows and navigates via NavManager.NavigateTo when requested. - WindowsTitleBarManager: added Doctor and Settings sidebar buttons (Doctor requests navigation to "/doctor", Settings opens the settings dialog), added a CreateSidebarButton helper to create styled icon buttons with tooltips and pointer hover effects. This enables native titlebar controls to trigger Blazor route navigation and provides new titlebar actions on Windows.
There was a problem hiding this comment.
Pull request overview
This PR enables native UI (Windows title bar) to trigger Blazor route navigation by extending IToolbarService with a navigation request event/API, wiring it up in MainLayout, and adding Doctor/Settings actions to the Windows title bar.
Changes:
- Extend
IToolbarService/ToolbarServicewithNavigationRequested+RequestNavigation(route)to request Blazor navigation from native UI. - Subscribe to
ToolbarService.NavigationRequestedinMainLayout.razor(Windows) and navigate viaNavigationManager.NavigateTo. - Add Doctor and Settings title bar buttons on Windows, plus a
CreateSidebarButtonhelper for consistent styling/hover/tooltip behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/MauiSherpa/Services/WindowsTitleBarManager.cs | Adds Doctor/Settings titlebar buttons and a reusable sidebar button factory. |
| src/MauiSherpa/Components/MainLayout.razor | Subscribes to native navigation requests and performs Blazor navigation on Windows. |
| src/MauiSherpa.Core/Services/ToolbarService.cs | Implements the new navigation request event and method on the toolbar service. |
| src/MauiSherpa.Core/Interfaces.cs | Adds the new navigation request event/method to IToolbarService. |
Redth
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose native-to-Blazor navigation on the toolbar service and hook it up in the main layout, plus add Doctor and Settings buttons to the Windows title bar.
Details:
This enables native titlebar controls to trigger Blazor route navigation and provides new titlebar actions on Windows.