Skip to content

[Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates#33786

Open
devanathan-vaithiyanathan wants to merge 7 commits intodotnet:mainfrom
devanathan-vaithiyanathan:fix-collapsed-pane-width
Open

[Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates#33786
devanathan-vaithiyanathan wants to merge 7 commits intodotnet:mainfrom
devanathan-vaithiyanathan:fix-collapsed-pane-width

Conversation

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Jan 30, 2026

Issue Details

The CollapsedPaneWidth value was not being properly applied to the native NavigationView.

Description of Change

On Windows, FlyoutPage.CollapsedPaneWidth was not being propagated to the native RootNavigationView, so changing the attached property had no effect on CompactPaneLength.

This PR wires PlatformConfiguration.WindowsSpecific.FlyoutPage.CollapsedPaneWidthProperty into the FlyoutPage mapper and applies the value to RootNavigationView.CompactPaneLength. It also adds a property-changed callback so runtime changes call Handler.UpdateValue(...) and update the native control after the handler is created.

A Windows UI test was added to cover both the initial partial-collapse setup and a runtime width change.

Note : FlyoutPage CollapsableStyle issue was resolved in PR #29927

Issues Fixed

Fixes #33785

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Windows
Before.mp4
Windows
After.mp4

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 30, 2026
@sheiksyedm
Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests 

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
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 PR fixes the FlyoutPage CollapsedPaneWidth property on Windows by implementing proper mapping from the MAUI property to the native NavigationView.CompactPaneLength property. The fix enables both initial and dynamic configuration of the collapsed pane width when using CollapseStyle.Partial.

Changes:

  • Added property change callback to trigger handler updates when CollapsedPaneWidth changes
  • Registered mapper for CollapsedPaneWidth property in FlyoutPage handler
  • Implemented mapper to apply CollapsedPaneWidth to native NavigationView.CompactPaneLength
  • Added UI test to verify CollapsedPaneWidth works both initially and when changed dynamically

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Controls/src/Core/PlatformConfiguration/WindowsSpecific/FlyoutPage.cs Added property changed callback (OnCollapsedPaneWidthChanged) to trigger handler updates when CollapsedPaneWidth property changes
src/Controls/src/Core/FlyoutPage/FlyoutPage.Mapper.cs Registered mapper for CollapsedPaneWidthProperty and implemented MapCollapsedPaneWidth to apply the value to NavigationView.CompactPaneLength
src/Controls/tests/TestCases.HostApp/Issues/Issue33785.cs Created UI test page that demonstrates CollapsedPaneWidth functionality with initial value (50) and dynamic change (100)
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33785.cs Implemented automated UI test that verifies CollapsedPaneWidth changes are applied correctly using screenshot verification

if (view is BindableObject bindable && handler.PlatformView is Microsoft.Maui.Platform.RootNavigationView navigationView)
{
var collapsedPaneWidth = PlatformConfiguration.WindowsSpecific.FlyoutPage.GetCollapsedPaneWidth(bindable);
if (collapsedPaneWidth > 0)
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.

The validation condition if (collapsedPaneWidth > 0) is inconsistent with the property's validation which allows values >= 0. A value of 0 is valid according to the BindableProperty definition (line 70 in FlyoutPage.cs), but this mapper would skip applying it. Consider changing the condition to >= 0 or removing it entirely since the property already validates non-negative values. The default value is 48, so the typical case of 0 would represent "use default" behavior, which should probably still be applied to the platform control.

Suggested change
if (collapsedPaneWidth > 0)
if (collapsedPaneWidth >= 0)

Copilot uses AI. Check for mistakes.
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 18, 2026

🤖 AI Summary

📊 Expand Full Review43386ab · mauibot concern addressed
🔍 Pre-Flight — Context & Validation

Issue: #33785 - FlyoutPage CollapsedPaneWidth is not working
PR: #33786 - [Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates
Platforms Affected: Windows only
Files Changed: 2 implementation, 2 test

Key Findings

  • FlyoutPage.CollapsedPaneWidth (Windows-specific attached property, default 48) was not wired into the MAUI handler mapper, so it had no effect on RootNavigationView.CompactPaneLength. The old Compatibility layer (FlyoutPageControl.cs) did apply it, but the new handler system was missing the mapping.
  • PR adds a #if WINDOWS mapper entry in FlyoutPage.Mapper.cs that reads GetCollapsedPaneWidth() and sets CompactPaneLength on the native RootNavigationView.
  • PR adds an OnCollapsedPaneWidthChanged propertyChanged callback on CollapsedPaneWidthProperty so runtime changes also call handler.UpdateValue(nameof(CollapsedPaneWidthProperty)) — this ensures the mapper fires on subsequent property changes.
  • The nameof strings used in the callback ("CollapsedPaneWidthProperty") and in the mapper registration (nameof(PlatformConfiguration.WindowsSpecific.FlyoutPage.CollapsedPaneWidthProperty)) both resolve to "CollapsedPaneWidthProperty" — they are consistent.
  • Gate FAILED (Windows): The test calls VerifyScreenshot() with no committed baseline image. VerifyScreenshot() compares to a file that doesn't exist in the repo, so the test fails regardless of whether the functional fix is correct.
  • Prior agent review (March 2026): Previous review ran on MacCatalyst (gate skipped as platform mismatch). 6 try-fix attempts were all BLOCKED by the same missing baseline screenshot issue. All models agreed the missing baseline is the real blocker, not the implementation.
  • Inline review comment (now outdated): Previous bot review flagged if (collapsedPaneWidth > 0) — this condition no longer exists in the current code; the mapper now unconditionally sets CompactPaneLength = collapsedPaneWidth.
  • CollapseStyle interaction: CollapseStyle (Partial vs Full) was already fixed in PR [Windows] FlyoutPage: update CollapseStyle at runtime #29927. The current PR only needs to ensure CompactPaneLength gets the right value when in LeftCompact mode.
  • Minor: Test files (Issue33785.cs in SharedTests) are missing a newline at end of file.
  • FlyoutLayoutBehavior = Popover is set in the test page — but CollapseStyle.Partial is also set. On Windows, Popover means LeftMinimal / Overlay, which may cause CompactPaneLength to have no visual effect since there's no compact pane displayed. This is a potential test design issue.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #33786 Add dedicated Windows CollapsedPaneWidth mapper + propertyChanged callback ❌ FAILED (Gate - missing baseline) 4 files Core logic appears correct; test fails due to missing VerifyScreenshot() baseline

🔧 Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix Integrate CollapseStyle + CompactPaneLength into existing FlyoutBehavior mapper; also switch PaneDisplayMode to LeftCompact when CollapseStyle.Partial; replace VerifyScreenshot() with label assertion ✅ PASS 3 files Reveals PR's critical bug: PR sets CompactPaneLength but stays in LeftMinimal mode where it has no effect
2 try-fix Interface-based approach (IPartialCollapseView): FlyoutPage implements interface in Controls; Core FlyoutViewHandler.Windows.cs checks interface in MapFlyoutBehavior and applies LeftCompact + CompactPaneLength; label assertion test ✅ PASS 5 files Architecturally cleaner Core/Controls boundary; also fixes PaneDisplayMode gap
3 try-fix (pending) - -
4 try-fix (pending) - -
PR PR #33786 Dedicated CollapsedPaneWidth mapper + propertyChanged callback; VerifyScreenshot() test ❌ FAILED (Gate) 4 files Missing baseline snapshot; also misses PaneDisplayMode=LeftCompact needed for CompactPaneLength to work

Cross-Pollination

Model Round New Ideas? Details
(pending round 2) - - -

Exhausted: No
Selected Fix: Pending all attempts


@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 18, 2026

🤖 AI Summary

📋 Expand PR Finalization Review

PR #33786 Finalization Review

Title Review

Current: [Windows] Fix FlyoutPage CollapsedPaneWidth is not working

Assessment: Acceptable, but it can be made more commit-history friendly by describing the implementation rather than the bug report.

Recommended title: [Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates

Description Review

Assessment: The current description is directionally correct, but it is incomplete.

What is good:

  • It identifies the affected API: CollapsedPaneWidth
  • It correctly says the fix is in the Windows FlyoutPage handler
  • It links the issue and marks Windows as tested

What is missing / should be improved:

  • Add the required NOTE block at the top so users can test PR artifacts
  • Keep the Description of Change / Issues Fixed structure from the PR template
  • Mention the property-changed callback, since the PR fixes dynamic updates as well as initial mapping
  • Mention the new Windows UI test added for the scenario
  • Remove or reword the stale note about CollapsableStyle; it is not central to this implementation and has a typo

Suggested description update:

[!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!

Description of Change

On Windows, FlyoutPage.CollapsedPaneWidth was not being propagated to the native RootNavigationView, so changing the attached property had no effect on CompactPaneLength.

This PR wires PlatformConfiguration.WindowsSpecific.FlyoutPage.CollapsedPaneWidthProperty into the FlyoutPage mapper and applies the value to RootNavigationView.CompactPaneLength. It also adds a property-changed callback so runtime changes call Handler.UpdateValue(...) and update the native control after the handler is created.

A Windows UI test was added to cover both the initial partial-collapse setup and a runtime width change.

Issues Fixed

Fixes #33785

Platforms Tested

  • Windows
  • Android
  • iOS
  • Mac

Code Review Findings

Critical Issues

CollapsedPaneWidth = 0 still does not work

  • File: src/Controls/src/Core/FlyoutPage/FlyoutPage.Mapper.cs
  • Problem: MapCollapsedPaneWidth() only applies the value when collapsedPaneWidth > 0.
  • Why this matters: The attached property explicitly validates >= 0, so 0 is a valid public API value. The old compatibility implementation also forwarded the value directly to CompactPaneLength without blocking zero. With the current PR, users still cannot set the pane width to 0, so the fix is incomplete.
  • Recommendation: Remove the > 0 guard and assign the value directly:
var collapsedPaneWidth = PlatformConfiguration.WindowsSpecific.FlyoutPage.GetCollapsedPaneWidth(bindable);
navigationView.CompactPaneLength = collapsedPaneWidth;

Suggestions

  • The new UI test exercises the scenario, but it does not assert the width numerically. If the test infrastructure makes that difficult, the current screenshot coverage is still better than no test.
  • Consider minor wording cleanup in the title/description so the eventual squash commit is easier to search.

Looks Good

  • The PR correctly adds both initial mapping and runtime update handling; this is the right shape for a bindable attached property fix.
  • The property-changed callback is scoped to FlyoutPage instances with a live handler, which avoids unnecessary work before handler creation.
  • The PR adds a Windows-specific HostApp scenario and matching UI test, which is appropriate for this bug.

Verdict

Not ready to merge as-is. The PR is very close, but the > 0 guard leaves a valid CollapsedPaneWidth value (0) broken, so the implementation does not fully honor the API contract yet.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Mar 18, 2026
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [Windows] Fix FlyoutPage CollapsedPaneWidth is not working [Windows] FlyoutPage: Fix CollapsedPaneWidth mapping and updates Mar 19, 2026
@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 -- 33786

Or

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

@kubaflo
Copy link
Copy Markdown
Contributor

kubaflo commented Mar 19, 2026

/azp run maui-pr-uitests

@kubaflo
Copy link
Copy Markdown
Contributor

kubaflo commented Mar 19, 2026

Could you please add the Windows snapshot? :)

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@MauiBot MauiBot added s/agent-gate-failed AI could not verify tests catch the bug s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates and removed s/agent-fix-win AI found a better alternative fix than the PR labels Mar 20, 2026
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 28, 2026

🚦 Gate — Test Verification

📊 Expand Full Gate43386ab · mauibot concern addressed

Gate Result: ❌ FAILED

Platform: WINDOWS

Tests Detected

# Type Test Name Filter
1 UITest Issue33785 Issue33785

Verification

Step Expected Actual Result
Without fix FAIL FAIL
With fix PASS FAIL

Test Execution

Without fix (expect FAIL):

  • Issue33785: FAIL (1 total, 0 passed, 1 failed) — 533 s
    • Failed: VerifyFlyoutPageCollapsedPaneWidth [4 s]
    • Error: VisualTestUtils.VisualTestFailedException : Baseline snapshot not yet created: D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\snapshots\windows\VerifyFlyoutPageCollapsedPaneWidt...

With fix (expect PASS):

  • Issue33785: FAIL (1 total, 0 passed, 1 failed) — 439 s
    • Failed: VerifyFlyoutPageCollapsedPaneWidth [4 s]
    • Error: VisualTestUtils.VisualTestFailedException : Baseline snapshot not yet created: D:\a\1\s\artifacts\bin\Controls.TestCases.WinUI.Tests\Debug\net10.0\snapshots\windows\VerifyFlyoutPageCollapsedPaneWidt...

Fix Files Reverted

  • eng/pipelines/ci-copilot.yml
  • src/Controls/src/Core/FlyoutPage/FlyoutPage.Mapper.cs
  • src/Controls/src/Core/PlatformConfiguration/WindowsSpecific/FlyoutPage.cs

Base Branch: main | Merge Base: 720a9d4


@MauiBot MauiBot added s/agent-review-incomplete AI agent could not complete all phases (blocker, timeout, error) and removed s/agent-changes-requested AI agent recommends changes - found a better alternative or issues labels Mar 28, 2026
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo left a comment

Choose a reason for hiding this comment

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

Could you please add a snapshot?

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor Author

Could you please add a snapshot?

@kubaflo , CollapseStyle issue was resolved in PR #29927. We also need those changes for collapsedPaneWidth to work properly. I will add an image once PR #29927 is merged.

@kubaflo
Copy link
Copy Markdown
Contributor

kubaflo commented Mar 30, 2026

@devanathan-vaithiyanathan okay! Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-flyoutpage FlyoutPage community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-failed AI could not verify tests catch the bug s/agent-review-incomplete AI agent could not complete all phases (blocker, timeout, error) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FlyoutPage CollapsedPaneWidth is not working

7 participants