Skip to content

Conversation

@KarthikRajaKalaimani
Copy link
Contributor

Issue Details:

The TitleView is not expanding to fullsize, when maximize the window in mac platform.

Root Cause:

The TitleView's frame is not recalculated when the navigation bar width changes, causing the layout to appear incorrect with stale positioning values in mac platform.

Description of Change:

I call the UpdateTitleViewFrameForOrientation() method from ViewWillTransitionToSize, which is the appropriate callback for MacCatalyst window resize events. This method runs alongside the transition coordinator’s animation, allowing the TitleView’s frame to be updated smoothly to match the new navigation bar dimensions.

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac

Reference:

N/A

Issues Fixed:

Fixes #33613

Screenshots

Before After
Screen.Recording.2026-01-29.at.12.10.45.PM.mov
Screen.Recording.2026-01-29.at.12.14.36.PM.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jan 29, 2026
@dotnet-policy-service
Copy link
Contributor

Hey there @@KarthikRajaKalaimani! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sheiksyedm
Copy link
Contributor

/rebase

@sheiksyedm
Copy link
Contributor



/azp run maui-pr-uitests 

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a MacCatalyst-specific issue where a custom TitleView in NavigationPage does not expand to full width when the window is maximized. The fix ensures the TitleView frame is properly recalculated during window resize events by calling UpdateTitleViewFrameForOrientation() within the ViewWillTransitionToSize animation coordinator.

Changes:

  • Added MacCatalyst-specific logic to update TitleView frame during window transitions
  • Created UI tests to verify TitleView expansion behavior across platforms (window maximize on MacCatalyst/Windows, orientation change on iOS/Android)

Reviewed changes

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

File Description
src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs Added MacCatalyst-specific code to call UpdateTitleViewFrameForOrientation() during view size transitions, ensuring TitleView frame updates alongside transition animations
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33613.cs NUnit test that verifies TitleView width increases after window maximize/orientation change
src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue33613.cs HostApp UI test page with NavigationPage containing a custom TitleView that demonstrates the resize behavior

Comment on lines +23 to +27
#if MACCATALYST || WINDOWS
App.EnterFullScreen();
#elif ANDROID || IOS
App.SetOrientationLandscape();
#endif
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Platform-specific conditional logic is implemented using inline preprocessor directives in the test method, which violates the UI testing guidelines. The guidelines explicitly state "No Inline #if Directives in Test Methods" to maintain code readability and cleanliness.

Move this platform-specific logic into an extension method. For example, create a method like ResizeOrRotateWindow that encapsulates the platform-specific behavior for testing window size changes.

Copilot generated this review using guidance from repository custom instructions.
#elif ANDROID || IOS
App.SetOrientationLandscape();
#endif
Thread.Sleep(1000); // Wait for the animation to complete
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Thread.Sleep is used here to wait for animation completion. According to the UI Testing Guidelines, there are better alternatives for handling animations and timing issues. The guidelines recommend:

  1. For animations: Use VerifyScreenshot with retryTimeout parameter instead of Thread.Sleep. For example: VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)) which will keep retrying until the animation completes.
  2. For element readiness: Use WaitForElement with appropriate timeout.

The current pattern doesn't guarantee that the animation has actually completed - it just waits an arbitrary amount of time. Using retryTimeout would be more robust as it keeps retrying until the expected state is reached.

Copilot generated this review using guidance from repository custom instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-titleview TitleView area-navigation NavigationPage community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/macos macOS / Mac Catalyst

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac Catalyst: NavigationPage.TitleView layout shifts and adds extra spacing when window is maximized

3 participants