Skip to content

[release/10.0.1xx-sr9] Fix Shell.Title binding in TitleView (#35800, #36334) - #36634

Closed
kubaflo wants to merge 2 commits into
release/10.0.1xx-sr9from
backport/pr-35800-36334-to-release/10.0.1xx-sr9
Closed

kubaflo wants to merge 2 commits into
release/10.0.1xx-sr9from
backport/pr-35800-36334-to-release/10.0.1xx-sr9

Conversation

@kubaflo

@kubaflo kubaflo commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Backports #35800 and #36334 to release/10.0.1xx-sr9.

Why both together

Changes

Cherry-picked from:

Fixes #36225 for SR9.

jfversluis and others added 2 commits July 17, 2026 18:49
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

`Shell.TitleView` content can bind to the Shell instance, but
`Shell.Title` was not updated from the active page title. This meant
bindings such as `{Binding Title, Source={x:Reference Shell}}` resolved
to `null` even when the current `ContentPage.Title` was set.

This change mirrors the effective current page or ShellContent title
into `Shell.Title` when Shell does not already have a user-set title.
The rendered toolbar title still remains empty while a custom TitleView
is active, and explicit Shell titles continue to work for Window title
fallback.

A core unit test covers the TitleView binding scenario and verifies
updates when the current page title changes.

### Issues Fixed

Fixes #35761

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 1ee8956)
…tive window/status bar (#36334)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Issue Details
Due to the changes introduced in PR #35800, when using Shell on Windows
and macOS (Mac Catalyst), the current page's title (intended for the
in-app navigation/title bar) was also being displayed in the native
window title bar and status bar.

### Description of Changes

<!-- Enter description of the fix in this section -->
The SetValueFromRenderer(Shell.TitleProperty, title) call was moved
inside the if (TitleView != null) block, so Shell.Title is only updated
by the renderer when a TitleView is present. Without a TitleView,
Shell.Title is left untouched, preventing the page title from
propagating to the native window/status bar.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #36225

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [ ] Android
- [x] Windows
- [ ] iOS
- [ ] Mac

| Before  | After  |
|---------|--------|
| **Mac**<br> <img
src="https://github.com/user-attachments/assets/fa030b4b-6199-429e-a74a-ed346e118e79"
width="600" height="300"> | **Mac**<br> <img
src="https://github.com/user-attachments/assets/491d4a74-6acf-458a-8d45-fe3dce25f22f"
width="600" height="300"> |

---------

(cherry picked from commit 8123cbb)
Copilot AI review requested due to automatic review settings July 17, 2026 16:52
@kubaflo kubaflo added this to the .NET 10 SR9 milestone Jul 17, 2026
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 17, 2026 16:52 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36634

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36634"

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 17, 2026 16:52 — with GitHub Actions Inactive
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 17, 2026 16:53 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 17, 2026 16:55 — with GitHub Actions Inactive
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 17, 2026 16:56 — with GitHub Actions Inactive
@github-actions github-actions Bot added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Jul 17, 2026
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool July 17, 2026 16:56 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backports the Shell.Title/TitleView behavior fix into release/10.0.1xx-sr9 so Shell.Title can be used reliably for bindings when a TitleView is present, while preventing page titles from leaking into the native window/status bar when no TitleView is set.

Changes:

  • Update ShellToolbar.UpdateTitle() to mirror the current page title into Shell.Title only when a TitleView exists and the user hasn’t set Shell.Title.
  • Add unit tests covering Shell.Title bindings in TitleView scenarios and ensuring page titles don’t propagate to native window title when no TitleView exists.
  • Add navigation coverage to ensure the “no propagation without TitleView” invariant holds after pushing pages.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Controls/src/Core/ShellToolbar.cs Guards renderer-driven Shell.Title updates behind TitleView != null and checks whether the user already set Shell.Title.
src/Controls/tests/Core.UnitTests/ShellToolbarTests.cs Adds tests validating Shell.Title reflects current page title for TitleView bindings and respects user-set Shell.Title bindings.
src/Controls/tests/Core.UnitTests/ShellTests.cs Adds regression tests to ensure page title does not propagate to Shell.Title / native window title when no TitleView is present, including after navigation.

Comment on lines 178 to +183
Title = String.Empty;
return;
}

Title = title;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 AI-generated reply on @kubaflo's behalf.

Thoughtful catch, but I'm keeping this out of scope for this PR. This is a servicing backport that cherry-picks #35800/#36334 exactly as merged to inflight/current (this branch's HEAD is the #36334 commit), so the UpdateTitle body here is byte-for-byte the reviewed/merged source.

The TitleView-removal reset you're describing isn't implemented on any branch: main/net11.0 don't renderer-set Shell.Title from UpdateTitle at all (that mechanism is introduced by #35800/#36334), and neither inflight/current nor this backport resets Shell.Title when TitleView becomes null. So it's a pre-existing edge case, not a regression introduced here.

Per servicing policy I don't want to add new, un-forward-ported behavior directly in an SR backport — it would diverge from the merged source. If the runtime TitleView-removal case is a real concern, the right path is a separate forward fix (happy to open one) that then flows through servicing, keeping this PR a faithful backport.

Comment on lines +299 to +303
contentPage.Title = "Updated Test Title";

Assert.Equal("Updated Test Title", testShell.Title);
Assert.Equal("Updated Test Title", label.Text);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 AI-generated reply on @kubaflo's behalf.

Same reasoning as the ShellToolbar.cs thread: this is a faithful backport of #35800/#36334, and resetting Shell.Title on TitleView removal isn't behavior this PR implements (nor main/net11.0/inflight/current), so I'm not adding a test for an unhandled transition here. If we forward-fix the removal case, its regression test should land with that fix — keeping the backported tests aligned with the merged source.

@kubaflo kubaflo closed this Jul 18, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 7706dedb Deployed Jul 17, 2026 by kubaflo via conclusion #835
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants