-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows/Android] Fix Dynamic ShellContent Title Updates at Runtime #27609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devanathan-vaithiyanathan
wants to merge
13
commits into
dotnet:main
Choose a base branch
from
devanathan-vaithiyanathan:fix-27494
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9e54729
Revert "Fixed CollectionViewHandler2 null reference exception if Item…
devanathan-vaithiyanathan 40f28ec
Reapply "Fixed CollectionViewHandler2 null reference exception if Ite…
devanathan-vaithiyanathan 20e8b48
fixed shellcontent runtime issue
devanathan-vaithiyanathan 1f98e5e
changes modified
devanathan-vaithiyanathan 98dd549
Changes added
devanathan-vaithiyanathan 1cd74f6
Removed condition in Script file
devanathan-vaithiyanathan c8c2ac8
Windows and Android snap added
devanathan-vaithiyanathan 87a4727
Test-case-modified
devanathan-vaithiyanathan 2a0414a
Windows snap removed
devanathan-vaithiyanathan 4dddc86
Windows snap added
devanathan-vaithiyanathan 6bc033e
Changes moved to extension method
devanathan-vaithiyanathan f51869b
co pilot concern addressed
devanathan-vaithiyanathan cdcabbf
AI review concern addressed
devanathan-vaithiyanathan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
15 changes: 15 additions & 0 deletions
15
src/Controls/src/Core/Platform/Windows/Extensions/ShellContentExtension.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using Microsoft.Maui.Controls.Handlers; | ||
|
|
||
| namespace Microsoft.Maui.Controls.Platform | ||
| { | ||
| internal static class ShellContentExtension | ||
| { | ||
| internal static void UpdateTitle(this ShellContent shellContent) | ||
| { | ||
| if (shellContent.Parent is ShellSection shellSection && shellSection.Parent is ShellItem shellItem && shellItem.Handler is ShellItemHandler shellItemHandler) | ||
| { | ||
| shellItemHandler.UpdateTitle(); | ||
| } | ||
| } | ||
| } | ||
| } |
Binary file added
BIN
+72.4 KB
...rols/tests/TestCases.Android.Tests/snapshots/android/VerifyExistingTabTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+68.1 KB
...ests/TestCases.Android.Tests/snapshots/android/VerifyFirstShellContentTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+73.4 KB
...TestCases.Android.Tests/snapshots/android/VerifyNewlyAddedShellContentTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Binary file added
BIN
+11 KB
...ntrols/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyExistingTabTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
.../tests/TestCases.WinUI.Tests/snapshots/windows/VerifyFirstShellContentTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.1 KB
...s/TestCases.WinUI.Tests/snapshots/windows/VerifyNewlyAddedShellContentTitle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapper was not invoking the method never?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsuarezruiz , Previously, the MapTitle method was only called when changing the title within the same ShellContent page, preventing title changes between different ShellContent pages. Since other platforms support this behavior, I removed MapTitle and applied the fix to the ShellSection. With this change, the title now updates correctly during the initial load, at runtime when adding ShellContent, and when changing title between ShellContent pages, ensuring consistency across all platforms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One difference between Windows and the other platforms is that Windows is the only platform that has the handlers correctly built against shell. So, I think we can use that to our advantage a bit here.
Like we could move all this code to an extention method and then on the shellcontent if the Title property changes we just call that extention method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PureWeen, Should we add the extension only for Windows ShellContent title changes, or should we consider applying this extension to other platforms as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will only currently apply to windows because of how the handlers are setup on Windows.
If it's straight forward to apply it to other platforms then you can try that, but, if it's not straight forward than just windows is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PureWeen, Since applying this to other platforms is not straightforward, I have moved the Windows-specific changes to an extension method for now