Repository navigation
[iOS/MacCatalyst] Fix NavigationRenderer toolbar items losing custom tint on IsEnabled changes - #39062
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39062Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39062" |
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Note 🔍
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Note 🔍
|
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@praveenkumarkarunanithi — new AI review results are available based on commit
ec4c7c5.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: IOS · Base: main · Merge base: b926f057
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🖥️ Issue39061 Issue39061 |
✅ FAIL — 296s | ✅ PASS — 108s |
🔴 Without fix — 🖥️ Issue39061: FAIL ✅ · 296s
Error-relevant lines (filtered from the build log):
at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 299
at Microsoft.Maui.TestCases.Tests.Issues.Issue39061.ToolbarItemPreservesCustomTintColorOnStateToggle() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39061.cs:line 26
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
🟢 With fix — 🖥️ Issue39061: PASS ✅ · 108s
(no coded error found; showing last 1200 chars)
t...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.13)
[xUnit.net 00:00:00.06] Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.16] Discovered: Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 10/8/2026 1:53:43 AM FixtureSetup for Issue39061(iOS)
>>>>> 10/8/2026 1:53:47 AM ToolbarItemPreservesCustomTintColorOnStateToggle Start
>>>>> 10/8/2026 1:53:49 AM ToolbarItemPreservesCustomTintColorOnStateToggle Stop
Passed ToolbarItemPreservesCustomTintColorOnStateToggle [1 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue39061.trx
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 22.4046 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue39061.trx
📁 Fix files reverted (2 files)
src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cssrc/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs
📋 Pre-Flight — Context & Validation
Pre-Flight Context
Scope and evidence: Context only for draft PR #39062 at head ec4c7c51, based on main at b9dc0cc2. Evidence includes the supplied immutable diff, read-only PR/issue metadata and discussion, the exact base-revision toolbar source, and linked regression PR #28185. No commands, tests, edits, artifacts, alternative fixes, or expert-review conclusions were produced.
Reported problem
- Issue #39061 reports that the iOS/Mac Catalyst compatibility
NavigationRendererrecreates all native right-side toolbar buttons when a primaryToolbarItem.IsEnabledchanges. - A custom renderer can apply native-only styling such as a per-item
UIBarButtonItem.TintColor. Rebuilding replaces those native objects, so the item tint falls back to the navigation bar tint. - The reproduction uses pink Save/Refresh items over a teal navigation-bar tint, disables both items while an alert is shown, then re-enables them after dismissal. Expected: pink remains. Reported actual result: buttons become teal.
- The issue reports .NET MAUI 10.0.0-preview.6 as the last working version and preview.7 as the first affected version. A validation comment reports reproduction on iOS and macOS from preview.7 onward.
- The PR attributes the regression to #28185, which introduced the modern iOS/Mac Catalyst secondary-toolbar overflow menu in .NET 10 preview 7. That PR explicitly noted that secondary menu actions are immutable and require menu reconstruction when enabled state changes.
Existing mechanism and submitted change
Base source confirms two overlapping property-change paths:
PrimaryToolbarItemsubscribes directly to itsToolbarItemand updatesUIBarButtonItem.Enabledin place.NavigationRendereralso subscribes to every tracked toolbar item. Before this change, anyIsEnabled,Text, orIconImageSourcechange scheduledUpdateToolbarItems().UpdateToolbarItems()detaches renderer subscriptions, disposes all existing right-bar and toolbar items, reconstructs primary buttons and secondaryUIActions, recreates the overflow button, and reinstalls the native collection. On iOS/Mac Catalyst 26, it also reapplies the navigation bar tint to the rebuilt items.
The submitted implementation changes two production files:
NavigationRenderer.cs- Ignores primary
IsEnablednotifications at renderer level, leaving the existingPrimaryToolbarItemto update its nativeEnabledproperty. - Retains full rebuilding for primary text/icon changes and structural collection changes.
- Adds
UpdateSecondaryMenuOnly(), which finds the existing overflow button byAccessibilityIdentifier == "SecondaryToolbarMenuButton", rebuilds secondary actions, and replaces only that button’sMenu. - Keeps the existing throttled main-thread dispatch and disposed check. The item that triggered the first pending update determines whether the callback performs a secondary-only or full update.
- Ignores primary
ToolbarItemExtensions.cs- Extracts
CreateSecondaryPlatformAction(ToolbarItem). - Initializes each new action’s command callback, asynchronously loaded image, enabled state, and automation identifier.
ToSecondarySubToolbarItem()now wraps an action produced by this helper, while partial secondary-menu reconstruction can use the action directly.
- Extracts
Changed test surfaces
The remaining six changed files provide regression coverage:
TestCases.HostApp/Issues/Issue39061.csadds the navigation page, two primary toolbar items, disable/alert/re-enable interaction, and a custom compatibility renderer that assigns teal navigation tint and pink item tint.TestCases.HostApp/MauiProgram.csregisters that renderer forIssue39061.TestCases.Shared.Tests/Tests/Issues/Issue39061.csadds an Appium/NUnit screenshot test that performs the toggle, dismisses the alert, waits forSaveItem, and verifies a screenshot.- Baselines are added for ordinary iOS, iOS 26, and Mac Catalyst.
The visual test establishes the post-toggle appearance but does not directly assert native UIBarButtonItem identity, inspect the disabled intermediate state, or separately assert both items’ tint values.
Platform-sensitive paths
- The production code is UIKit-specific compatibility-renderer code under iOS paths used by both iOS and Mac Catalyst.
- Host and test code is guarded by
IOS || MACCATALYST; Android and Windows do not compile these additions. - The affected surface is the compatibility
NavigationRenderer, not established here as applying to newer navigation handlers. - iOS/Mac Catalyst 26 has an additional tint-reapplication branch during full toolbar reconstruction, which explains the dedicated
ios-26baseline. - Secondary items use
UIAction/UIMenu; primary items useUIBarButtonItem. Their update and lifetime behavior therefore differ. - Requested validation platform is iOS.
Validation evidence and requirements
- Supplied Gate result: passed — test fails without the fix and passes with it. It was not rerun.
- A public Gate report for commit
841cc1erecords the iOSIssue39061screenshot test failing without the two production-file changes and passing with them. - The same report records 26 passing ToolbarItem UI tests and one skipped test in its deeper iOS category run.
- An earlier CI analysis found the Mac Catalyst test lacked a baseline at
841cc1e. Current headec4c7c51adds only the Mac snapshot, apparently addressing that specific missing-file condition; current-head Mac execution evidence is unknown. - Validation should preserve the test’s essential observable: after disabling and re-enabling the primary items around an alert, their custom pink native tint remains rather than reverting to teal.
- Validation also needs to cover existing primary text/icon updates, secondary text/icon/enabled updates, secondary action invocation, overflow-button preservation, automation identifiers, and add/remove structural rebuilds because the change splits one rebuild path into two.
- No additional local validation was performed.
Remaining uncertainties
- PR #39062 remains marked draft/WIP and blocked; a new iOS review/CI run had started, but its outcome was not available.
- Exact current-head Gate details are unknown. The detailed public Gate result references
841cc1e; current head adds a binary Mac baseline after that commit. - The actual pixels and expected colors in the three binary snapshot files were not inspectable from the textual diff, so their visual correctness is unknown.
- Exact iOS device, simulator model, OS patch level, screenshot tolerance, and Mac Catalyst runtime used for current-head validation are unknown.
UpdateSecondaryMenuOnly()silently returns when the overflow button cannot be found; behavior for that state is not established by the supplied evidence.- Secondary image loading remains asynchronous. Menu replacement while image loading is pending, rapid changes across multiple toolbar items under the shared throttle, and disposal/lifetime interactions require expert review.
- The supplied test verifies appearance rather than proving that primary native objects are retained, so another mechanism that happened to reproduce the expected pixels would also satisfy it.
- No exhaustive review is claimed, and no comparative recommendation or winner is declared.
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Verdict
LGTM
Confidence: medium
The single maui-expert-reviewer pass completed against the submitted PR diff and produced no validated inline findings. inline-findings.json contains an empty JSON array.
Independent Assessment
The submitted fix separates toolbar-item property updates by native representation:
- A primary
ToolbarItem.IsEnabledchange no longer triggers a complete toolbar reconstruction; the existingPrimaryToolbarItemcontinues updating itsUIBarButtonItem.Enabledstate in place. - Secondary text, icon, and enabled-state changes rebuild the immutable
UIActioncollection and replace only the existing overflow button'sUIMenu. - Primary text/icon changes and structural collection changes retain the complete toolbar rebuild path.
This directly addresses the reported loss of native-only UIBarButtonItem tint while preserving the reconstruction required by immutable secondary menu actions.
Blast Radius and Failure-Mode Probing
- Scope: Compatibility
NavigationRenderertoolbar handling on iOS and Mac Catalyst; no shared startup or static state was added. - Primary items: The changed
IsEnabledpath preserves native button identity while the existing primary wrapper remains responsible for propagating enabled state. - Secondary items: The submitted path recreates secondary actions and the menu while preserving primary buttons and the overflow button.
- Lifecycle/threading: The existing throttled main-thread dispatch and disposed guard remain in place. The expert pass found no concrete source-backed lifecycle, rapid-update, or asynchronous-image failure scenario on changed lines.
- External output and Trim/AOT contracts: Not applicable to this change.
Evidence
- Gate: ✅ PASSED on iOS;
Issue39061failed without the production fix and passed with it. - Regression cross-reference: No overlap was detected with labeled bug-fix PRs touching the modified files in the configured lookback.
- Expert inline findings: 0 errors, 0 warnings, 0 suggestions.
Refinement Decision
No pr-plus-reviewer refinement was created. The expert findings did not identify the concrete actionable defect or unresolved behavioral mechanism required by the evidence-first refinement threshold.
🛠️ Try-Fix — Analysis & Comparison
Alternative generation: not requested
Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Trusted read-only evidence-first context consumed |
| Code Review | LGTM (medium) | Single expert pass; 0 errors, 0 warnings |
| Gate | ✅ PASSED | iOS Issue39061 failed without the fix and passed with it |
| Try-Fix | NOT REQUESTED | Intentional evidence-first omission; no alternative search was performed |
| Refinement | NOT CREATED | No expert finding met the evidence threshold |
| Report | ✅ COMPLETE | Raw submitted PR is the sole real candidate |
Code Review and Candidate Comparison
| Rank | Candidate | Validation | Expert Findings | Assessment |
|---|---|---|---|---|
| 1 | pr |
✅ Trusted iOS Gate passed | None | Preserves primary native buttons for IsEnabled updates while rebuilding immutable secondary menu actions as required |
No try-fix-* candidates were requested, and no pr-plus-reviewer candidate was implemented. The submitted PR therefore wins as the only real candidate; no missing or unvalidated candidate is treated as evidence.
Summary
The submitted fix is narrowly scoped to the iOS/Mac Catalyst compatibility NavigationRenderer, passes the trusted regression Gate, and completed the single expert review without a blocking error or discussion item. The raw PR candidate is selected.
Root Cause
NavigationRenderer observed the same primary ToolbarItem.IsEnabled notification already handled by PrimaryToolbarItem and responded by rebuilding every native toolbar item. Replacing the existing UIBarButtonItem instances discarded native-only styling such as per-item tint colors.
Fix Quality
The fix preserves primary native button identity for enabled-state changes, retains full reconstruction for structural and primary text/icon changes, and limits secondary property updates to rebuilding the immutable UIAction/UIMenu state. The focused iOS screenshot regression test demonstrates the reported failure without the fix and the expected retained tint with it. Try-Fix was intentionally not requested, and the expert pass supplied no evidence-backed reason to refine the submitted implementation.
📱 UI Tests — ToolbarItem
Detected UI test categories: ToolbarItem
✅ Deep UI tests — 26 passed, 0 failed, 1 skipped across 1 category on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
ToolbarItem |
26/27 (1 skipped) ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🔵 Needs a closer look
Complete platform validation is unavailable, so the native toolbar changes still need human review.
1 open finding
What changed in this PR
Fixes #39061 by preserving native toolbar styling in the iOS/MacCatalyst compatibility NavigationRenderer.
Changes:
- Updates primary enabled state without rebuilding toolbar buttons.
- Refreshes secondary menus while retaining existing buttons.
- Adds a custom-tint regression scenario and UI test.
| File | Description |
|---|---|
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39061.cs | Verifies tint after enabled-state toggles. |
| src/Controls/tests/TestCases.HostApp/MauiProgram.cs | Registers the custom test renderer. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue39061.cs | Adds the tinted-toolbar reproduction. |
| src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs | Extracts secondary action creation. |
| src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs | Separates menu refreshes from toolbar rebuilds. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| } | ||
|
|
||
| if (secondaries is not null) | ||
| menuButton.Menu = UIMenu.Create(string.Empty, null, UIMenuIdentifier.Edit, UIMenuOptions.DisplayInline, secondaries.ToArray()); |
…entation (#39321) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Focused manual SR12 backport of #38947, intentionally targeting **inflight/candidate**, not main. Original merge commit: `e7d746154382c0b449c2dd82a6139ce79c06de8b`; equivalent rebased source used: `25f148397192c18f435036c7ca82bfafe07f346b`. Candidate starting point: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`. Retains both title and icon for native primary toolbar items only on iOS 27.1+, preserves legacy iOS/MacCatalyst rendering, refreshes dynamic Shell secondary metadata, and carries the original stale-image-load/disposal safeguards and both original device-test files unchanged. No public API, ordering, axis, Priority, or scene changes. Exactly the four source files are included; no other Apple compatibility backports are bundled. The automatic backport [failed](https://github.com/dotnet/maui/actions/runs/38235392353) and was not retriggered. The complete-source cherry-pick conflicts only in `ToolbarItemExtensions.cs` because Candidate already contains #39062. Resolution retains `CreateSecondaryPlatformAction`, its enabled state and accessibility identifier, and uses the source's synchronous `GetPlatformMenuImage` path to initialize fresh actions for the Candidate-only secondary-menu refresh. This avoids reintroducing the source-removed redundant asynchronous image load. `NavigationRenderer.cs` and its #39062 in-place primary enabled-state / secondary-menu-only updates are untouched, preserving existing native button identity and tint. Shell and original tests match source exactly. **Build-only validation** (all commands run in this isolated worktree with installed SDK 10.0.100 via `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll`; Candidate pins 10.0.113-servicing.26454.107, while default `dotnet --version` selects 11.0.100-preview.6.26359.118; no tracked SDK/workload/package pins changed): - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf --no-restore -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — initially failed: missing assets/reference assemblies. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed after restore, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios26.0 -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — failed: test project declares `net10.0-ios`, not this TFM. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — full native app build blocked: installed iOS SDK 26.1.10494 requires Xcode 26.1, but local Xcode is 26.6. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll msbuild src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -t:Compile -p:TargetFramework=net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed managed compilation; verified new toolbar test symbols in generated `Microsoft.Maui.Controls.DeviceTests.dll`. This is not native packaging or runtime testing. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format whitespace . --folder --include src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.iOS.cs --verify-no-changes --verbosity quiet` — passed. An initial project-format attempt with `-p:TargetFramework=net10.0-ios26.0` was rejected as an unsupported format option; replaced with this four-file folder check. - `git diff --cached --check` — passed before commit; source comparison confirmed both test files and Shell file unchanged from source, with only the documented Candidate action-factory adaptation. No XCTest, Appium, simulator boot/launch, native app execution, or GUI runtime testing was performed. Runtime validation and CI remain required; this PR is not asserted merge-ready. ### 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. --> N/A — source #38947 has no linked issue. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…tint on IsEnabled changes (#39062) <!-- 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! ### Root Cause The iOS/Mac Catalyst compatibility `NavigationRenderer` handled every relevant `ToolbarItem` property change by rebuilding the complete native toolbar. Primary `IsEnabled` changes therefore replaced the existing `UIBarButtonItem` instances, even though `PrimaryToolbarItem` already updates the native `Enabled` state directly. This unnecessary reconstruction discarded native-only styling such as custom per-item tint colors. ### Description of Change • Skip the complete toolbar rebuild for primary `ToolbarItem.IsEnabled` changes and allow the existing native button to update in place. • Recreate only the secondary `UIAction` collection and `UIMenu` when a secondary item’s text, icon, or enabled state changes. • Preserve the existing primary buttons and overflow button during secondary menu updates. • Keep the existing complete rebuild behavior for structural changes such as adding or removing toolbar items. ### Issues Fixed Fixes #39061 Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Note Regression is specific to the iOS/Mac Catalyst compatibility NavigationRenderer and UIKit toolbar items. ### Regression Details: Regressed by PR #28185 ### Output Video Before Issue Fix | After Issue Fix | |----------|----------| |<video width="40" height="60" alt="Before Fix" src="https://github.com/user-attachments/assets/f02dc9b4-9472-49e9-9416-e208ca32a2a5">|<video width="50" height="40" alt="After Fix" src="https://github.com/user-attachments/assets/f1c880b8-b4b9-418c-bed7-3ce750633037">|
…entation (#39321) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Focused manual SR12 backport of #38947, intentionally targeting **inflight/candidate**, not main. Original merge commit: `e7d746154382c0b449c2dd82a6139ce79c06de8b`; equivalent rebased source used: `25f148397192c18f435036c7ca82bfafe07f346b`. Candidate starting point: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`. Retains both title and icon for native primary toolbar items only on iOS 27.1+, preserves legacy iOS/MacCatalyst rendering, refreshes dynamic Shell secondary metadata, and carries the original stale-image-load/disposal safeguards and both original device-test files unchanged. No public API, ordering, axis, Priority, or scene changes. Exactly the four source files are included; no other Apple compatibility backports are bundled. The automatic backport [failed](https://github.com/dotnet/maui/actions/runs/38235392353) and was not retriggered. The complete-source cherry-pick conflicts only in `ToolbarItemExtensions.cs` because Candidate already contains #39062. Resolution retains `CreateSecondaryPlatformAction`, its enabled state and accessibility identifier, and uses the source's synchronous `GetPlatformMenuImage` path to initialize fresh actions for the Candidate-only secondary-menu refresh. This avoids reintroducing the source-removed redundant asynchronous image load. `NavigationRenderer.cs` and its #39062 in-place primary enabled-state / secondary-menu-only updates are untouched, preserving existing native button identity and tint. Shell and original tests match source exactly. **Build-only validation** (all commands run in this isolated worktree with installed SDK 10.0.100 via `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll`; Candidate pins 10.0.113-servicing.26454.107, while default `dotnet --version` selects 11.0.100-preview.6.26359.118; no tracked SDK/workload/package pins changed): - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf --no-restore -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — initially failed: missing assets/reference assemblies. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed after restore, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios26.0 -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — failed: test project declares `net10.0-ios`, not this TFM. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — full native app build blocked: installed iOS SDK 26.1.10494 requires Xcode 26.1, but local Xcode is 26.6. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll msbuild src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -t:Compile -p:TargetFramework=net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed managed compilation; verified new toolbar test symbols in generated `Microsoft.Maui.Controls.DeviceTests.dll`. This is not native packaging or runtime testing. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format whitespace . --folder --include src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.iOS.cs --verify-no-changes --verbosity quiet` — passed. An initial project-format attempt with `-p:TargetFramework=net10.0-ios26.0` was rejected as an unsupported format option; replaced with this four-file folder check. - `git diff --cached --check` — passed before commit; source comparison confirmed both test files and Shell file unchanged from source, with only the documented Candidate action-factory adaptation. No XCTest, Appium, simulator boot/launch, native app execution, or GUI runtime testing was performed. Runtime validation and CI remain required; this PR is not asserted merge-ready. ### 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. --> N/A — source #38947 has no linked issue. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…tint on IsEnabled changes (#39062) <!-- 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! ### Root Cause The iOS/Mac Catalyst compatibility `NavigationRenderer` handled every relevant `ToolbarItem` property change by rebuilding the complete native toolbar. Primary `IsEnabled` changes therefore replaced the existing `UIBarButtonItem` instances, even though `PrimaryToolbarItem` already updates the native `Enabled` state directly. This unnecessary reconstruction discarded native-only styling such as custom per-item tint colors. ### Description of Change • Skip the complete toolbar rebuild for primary `ToolbarItem.IsEnabled` changes and allow the existing native button to update in place. • Recreate only the secondary `UIAction` collection and `UIMenu` when a secondary item’s text, icon, or enabled state changes. • Preserve the existing primary buttons and overflow button during secondary menu updates. • Keep the existing complete rebuild behavior for structural changes such as adding or removing toolbar items. ### Issues Fixed Fixes #39061 Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Note Regression is specific to the iOS/Mac Catalyst compatibility NavigationRenderer and UIKit toolbar items. ### Regression Details: Regressed by PR #28185 ### Output Video Before Issue Fix | After Issue Fix | |----------|----------| |<video width="40" height="60" alt="Before Fix" src="https://github.com/user-attachments/assets/f02dc9b4-9472-49e9-9416-e208ca32a2a5">|<video width="50" height="40" alt="After Fix" src="https://github.com/user-attachments/assets/f1c880b8-b4b9-418c-bed7-3ce750633037">|
…entation (#39321) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Focused manual SR12 backport of #38947, intentionally targeting **inflight/candidate**, not main. Original merge commit: `e7d746154382c0b449c2dd82a6139ce79c06de8b`; equivalent rebased source used: `25f148397192c18f435036c7ca82bfafe07f346b`. Candidate starting point: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`. Retains both title and icon for native primary toolbar items only on iOS 27.1+, preserves legacy iOS/MacCatalyst rendering, refreshes dynamic Shell secondary metadata, and carries the original stale-image-load/disposal safeguards and both original device-test files unchanged. No public API, ordering, axis, Priority, or scene changes. Exactly the four source files are included; no other Apple compatibility backports are bundled. The automatic backport [failed](https://github.com/dotnet/maui/actions/runs/38235392353) and was not retriggered. The complete-source cherry-pick conflicts only in `ToolbarItemExtensions.cs` because Candidate already contains #39062. Resolution retains `CreateSecondaryPlatformAction`, its enabled state and accessibility identifier, and uses the source's synchronous `GetPlatformMenuImage` path to initialize fresh actions for the Candidate-only secondary-menu refresh. This avoids reintroducing the source-removed redundant asynchronous image load. `NavigationRenderer.cs` and its #39062 in-place primary enabled-state / secondary-menu-only updates are untouched, preserving existing native button identity and tint. Shell and original tests match source exactly. **Build-only validation** (all commands run in this isolated worktree with installed SDK 10.0.100 via `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll`; Candidate pins 10.0.113-servicing.26454.107, while default `dotnet --version` selects 11.0.100-preview.6.26359.118; no tracked SDK/workload/package pins changed): - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf --no-restore -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — initially failed: missing assets/reference assemblies. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed after restore, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios26.0 -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — failed: test project declares `net10.0-ios`, not this TFM. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — full native app build blocked: installed iOS SDK 26.1.10494 requires Xcode 26.1, but local Xcode is 26.6. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll msbuild src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -t:Compile -p:TargetFramework=net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed managed compilation; verified new toolbar test symbols in generated `Microsoft.Maui.Controls.DeviceTests.dll`. This is not native packaging or runtime testing. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format whitespace . --folder --include src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.iOS.cs --verify-no-changes --verbosity quiet` — passed. An initial project-format attempt with `-p:TargetFramework=net10.0-ios26.0` was rejected as an unsupported format option; replaced with this four-file folder check. - `git diff --cached --check` — passed before commit; source comparison confirmed both test files and Shell file unchanged from source, with only the documented Candidate action-factory adaptation. No XCTest, Appium, simulator boot/launch, native app execution, or GUI runtime testing was performed. Runtime validation and CI remain required; this PR is not asserted merge-ready. ### 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. --> N/A — source #38947 has no linked issue. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
…tint on IsEnabled changes (#39062) <!-- 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! ### Root Cause The iOS/Mac Catalyst compatibility `NavigationRenderer` handled every relevant `ToolbarItem` property change by rebuilding the complete native toolbar. Primary `IsEnabled` changes therefore replaced the existing `UIBarButtonItem` instances, even though `PrimaryToolbarItem` already updates the native `Enabled` state directly. This unnecessary reconstruction discarded native-only styling such as custom per-item tint colors. ### Description of Change • Skip the complete toolbar rebuild for primary `ToolbarItem.IsEnabled` changes and allow the existing native button to update in place. • Recreate only the secondary `UIAction` collection and `UIMenu` when a secondary item’s text, icon, or enabled state changes. • Preserve the existing primary buttons and overflow button during secondary menu updates. • Keep the existing complete rebuild behavior for structural changes such as adding or removing toolbar items. ### Issues Fixed Fixes #39061 Tested the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Note Regression is specific to the iOS/Mac Catalyst compatibility NavigationRenderer and UIKit toolbar items. ### Regression Details: Regressed by PR #28185 ### Output Video Before Issue Fix | After Issue Fix | |----------|----------| |<video width="40" height="60" alt="Before Fix" src="https://github.com/user-attachments/assets/f02dc9b4-9472-49e9-9416-e208ca32a2a5">|<video width="50" height="40" alt="After Fix" src="https://github.com/user-attachments/assets/f1c880b8-b4b9-418c-bed7-3ce750633037">|
…entation (#39321) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> Focused manual SR12 backport of #38947, intentionally targeting **inflight/candidate**, not main. Original merge commit: `e7d746154382c0b449c2dd82a6139ce79c06de8b`; equivalent rebased source used: `25f148397192c18f435036c7ca82bfafe07f346b`. Candidate starting point: `29eb037ad1cac21acdc052bc7a1211a8bb37d3c9`. Retains both title and icon for native primary toolbar items only on iOS 27.1+, preserves legacy iOS/MacCatalyst rendering, refreshes dynamic Shell secondary metadata, and carries the original stale-image-load/disposal safeguards and both original device-test files unchanged. No public API, ordering, axis, Priority, or scene changes. Exactly the four source files are included; no other Apple compatibility backports are bundled. The automatic backport [failed](https://github.com/dotnet/maui/actions/runs/38235392353) and was not retriggered. The complete-source cherry-pick conflicts only in `ToolbarItemExtensions.cs` because Candidate already contains #39062. Resolution retains `CreateSecondaryPlatformAction`, its enabled state and accessibility identifier, and uses the source's synchronous `GetPlatformMenuImage` path to initialize fresh actions for the Candidate-only secondary-menu refresh. This avoids reintroducing the source-removed redundant asynchronous image load. `NavigationRenderer.cs` and its #39062 in-place primary enabled-state / secondary-menu-only updates are untouched, preserving existing native button identity and tint. Shell and original tests match source exactly. **Build-only validation** (all commands run in this isolated worktree with installed SDK 10.0.100 via `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll`; Candidate pins 10.0.113-servicing.26454.107, while default `dotnet --version` selects 11.0.100-preview.6.26359.118; no tracked SDK/workload/package pins changed): - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf --no-restore -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — initially failed: missing assets/reference assemblies. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build Microsoft.Maui.BuildTasks.slnf -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed after restore, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/src/Core/Controls.Core.csproj -f net10.0-ios26.0 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed, 0 warnings / 0 errors. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios26.0 -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — failed: test project declares `net10.0-ios`, not this TFM. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — full native app build blocked: installed iOS SDK 26.1.10494 requires Xcode 26.1, but local Xcode is 26.6. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll msbuild src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -t:Compile -p:TargetFramework=net10.0-ios -p:RuntimeIdentifier=iossimulator-arm64 -p:IncludeAndroidTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeTizenTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q` — passed managed compilation; verified new toolbar test symbols in generated `Microsoft.Maui.Controls.DeviceTests.dll`. This is not native packaging or runtime testing. - `dotnet /usr/local/share/dotnet/sdk/10.0.100/dotnet.dll format whitespace . --folder --include src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellPageRendererTracker.cs src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.iOS.cs --verify-no-changes --verbosity quiet` — passed. An initial project-format attempt with `-p:TargetFramework=net10.0-ios26.0` was rejected as an unsupported format option; replaced with this four-file folder check. - `git diff --cached --check` — passed before commit; source comparison confirmed both test files and Shell file unchanged from source, with only the documented Candidate action-factory adaptation. No XCTest, Appium, simulator boot/launch, native app execution, or GUI runtime testing was performed. Runtime validation and CI remain required; this PR is not asserted merge-ready. ### 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. --> N/A — source #38947 has no linked issue. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>

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!
Root Cause
The iOS/Mac Catalyst compatibility
NavigationRendererhandled every relevantToolbarItemproperty change by rebuilding the complete native toolbar. PrimaryIsEnabledchanges therefore replaced the existingUIBarButtonIteminstances, even thoughPrimaryToolbarItemalready updates the nativeEnabledstate directly. This unnecessary reconstruction discarded native-only styling such as custom per-item tint colors.Description of Change
• Skip the complete toolbar rebuild for primary
ToolbarItem.IsEnabledchanges and allow the existing native button to update in place.• Recreate only the secondary
UIActioncollection andUIMenuwhen a secondary item’s text, icon, or enabled state changes.• Preserve the existing primary buttons and overflow button during secondary menu updates.
• Keep the existing complete rebuild behavior for structural changes such as adding or removing toolbar items.
Issues Fixed
Fixes #39061
Tested the behaviour in the following platforms
Note
Regression is specific to the iOS/Mac Catalyst compatibility NavigationRenderer and UIKit toolbar items.
Regression Details:
Regressed by PR #28185
Output Video
BeforeFix.mov
AfterFix.mov