Repository navigation
fix(navigationbar): render UIElement Content on Simple primary commands (backport #1653) - #1659
Merged
Merged
Conversation
…ds (#1653) Co-authored-by: Claude Fable 5.1 <[email protected]> (cherry picked from commit 439331f) # Conflicts: # specs/lessons.md
Contributor
Author
|
Cherry-pick of 439331f has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
9 tasks done
Contributor
|
|
- specs/lessons.md: drop the committed conflict markers and the main-only entries the cherry-pick dragged in; keep servicing's file plus the one new AppBarButton lesson from #1653. - NavigationBarTests.PrimaryCommands.cs: declare the partial without an access modifier (NavigationBarTests is internal on servicing, public on main; CS0262), and replace Assert.IsNotNull with an explicit null guard since servicing's MSTest does not annotate it for nullable flow (CS8604 under warnings-as-errors). Co-Authored-By: Claude Opus 5.5 <[email protected]>
agneszitte
approved these changes
Oct 6, 2026
Merged
1 task done
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.
GitHub Issue (If applicable): closes #1652
PR Type
What kind of change does this PR introduce?
What is the current behavior?
In the Simple toolkit theme, an
AppBarButtoninNavigationBar.PrimaryCommandswhoseContentis aUIElement(e.g. aGridwrapping aTextBlock) renders an empty slot. StringContentandIconrender fine.Uno's
AppBarButton(AppBarButton.uno.cs,SetupContentUpdate) looks up the template part namedContentand force-sets it toIcon ?? Content. The toolkit's ownSimpleAppBarButtonStyleinsrc/library/Uno.Toolkit.Simple/Styles/Controls/NavigationBar.xamlused that name for the icon presenter inside theViewboxthat collapses whenIconis null. With noIcon, Uno moves the user'sContentinto that collapsed presenter; aUIElementcan only have one visual parent, so it is torn out of the visibleContentPresenter. A string survives because it can be displayed by two presenters at once. Same root cause as unoplatform/Uno.Themes#1735 (fixed in unoplatform/Uno.Themes#1736); the toolkit copy of the style needs the same fix because the NavigationBar resolves its ownSimpleAppBarButtonStyleat parse time.What is the new behavior?
SimpleAppBarButtonStyle: the icon presenter is renamed toIconPresenter(plus its three visual-state setters), with a comment explaining why the part must not be namedContent.SimpleMainCommandStyleis left untouched since that template never displaysContent(it shows the back-arrowPathIconwhenIconis null).NavigationBarTests.Simple_PrimaryCommands_Render_Icon_And_Content_Variants(inNavigationBarTests.PrimaryCommands.cs, partial of the existing class): a Simple-themedNavigationBarwith Icon-only, string-Content, UIElement-Content and Icon + Content primary commands; each marker element must be inside its button, not under a collapsed ancestor, and laid out. Red/fix/green: fails onmain, passes with the fix. The wholeNavigationBar*filter (19 tests) passes on the Simple desktop head in Release.specs/lessons.mdrecords the template-part hijack.Material v2 primary commands are not touched here: they are
BasedOnUno.Themes'MaterialAppBarButtonStyle, so they pick up the fix onceUnoThemesVersionis bumped to a build containing Uno.Themes#1736.PR Checklist
Please check if your PR fulfills the following requirements:
Other information
Two pre-existing local-dev issues noticed while validating, both out of scope:
Debug.AssertinSafeArea.CreateWeakHandler, because static lambdas have a non-nullTarget(the compiler's<>csingleton). Release is unaffected. Similar to what fix(responsive): reconnect a re-parented host instead of tearing down #1647 fixed forResponsiveExtensions.Uno.Toolkit.Simple/Styles/Controls/NavigationBar.xamlonmainas well; formatting it would rewrite the whole file, so this PR keeps the file's existing style.🤖 Generated with Claude Code
This is an automatic backport of pull request #1653 done by [Mergify](https://mergify.com).