KEMBAR78
[Windows, Catalyst] Fix IsPresented=true Not Working on Initial Value in FlyoutPage by devanathan-vaithiyanathan · Pull Request #31515 · dotnet/maui · GitHub
Skip to content

Conversation

devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Sep 8, 2025

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!

Issue Details

When setting IsPresented="True" on a FlyoutPage in .NET MAUI , the flyout does not open automatically on app launch as expected.

Description of Change

On macOS, the frame observer connection is delayed using DispatchQueue.MainQueue.DispatchAsync() so XAML properties finish loading before observation starts.

On Windows, PlatformView is loaded before applying the IsPresented value.

Issues Fixed

Fixes #31372

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Mac
Mac

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Sep 8, 2025
@dotnet-policy-service
Copy link
Contributor

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

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Sep 8, 2025
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the base branch from fix-31372 to main September 8, 2025 11:06
@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review September 8, 2025 11:09
@Copilot Copilot AI review requested due to automatic review settings September 8, 2025 11:09
@devanathan-vaithiyanathan devanathan-vaithiyanathan requested a review from a team as a code owner September 8, 2025 11:09
Copy link
Contributor

@Copilot 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 an issue where setting IsPresented="true" on a FlyoutPage doesn't open the flyout automatically on app launch for Windows and macOS Catalyst platforms. The fix addresses timing issues where platform views are loaded before XAML properties are applied.

  • Delays frame observer connection on macOS Catalyst using DispatchQueue to ensure XAML properties load first
  • Adds a Loaded event handler on Windows to apply IsPresented value after platform view is ready
  • Includes comprehensive UI tests to validate the fix

Reviewed Changes

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

File Description
src/Core/src/Handlers/Window/WindowHandler.iOS.cs Conditionally delays frame observer connection for macOS Catalyst using DispatchQueue
src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs Adds Loaded event handler to apply IsPresented value after platform view initialization
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31372.cs NUnit test to verify flyout is presented on initial load
src/Controls/tests/TestCases.HostApp/Issues/Issue31372.cs UI test page demonstrating FlyoutPage with IsPresented=true

Comment on lines +27 to 33
void OnLoaded(object sender, RoutedEventArgs e)
{
if (VirtualView is not null)
{
PlatformView.IsPaneOpen = VirtualView.IsPresented;
}
}
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

The OnLoaded event handler will fire every time the control is loaded, but the IsPresented synchronization only needs to happen once. Consider unsubscribing from the Loaded event after the first execution to avoid unnecessary repeated executions.

Copilot uses AI. Check for mistakes.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen added this to the .NET 9 SR12 milestone Sep 8, 2025
@PureWeen PureWeen added the p/0 Work that we can't release without label Sep 8, 2025
jsuarezruiz
jsuarezruiz previously approved these changes Sep 9, 2025
@github-project-automation github-project-automation bot moved this from Todo to Approved in MAUI SDK Ongoing Sep 9, 2025
@PureWeen PureWeen changed the base branch from main to inflight/current September 11, 2025 15:59
@PureWeen PureWeen changed the base branch from inflight/current to main September 11, 2025 16:01
@PureWeen PureWeen dismissed jsuarezruiz’s stale review September 11, 2025 16:01

The base branch was changed.

@github-project-automation github-project-automation bot moved this from Approved to Changes Requested in MAUI SDK Ongoing Sep 11, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

if (!_intialLayoutFinished)
{
_intialLayoutFinished = true;
SetInitialPresented();
Copy link
Contributor

Choose a reason for hiding this comment

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

ViewDidAppear() is much later in the lifecycle. Not a problem, but this could cause a visible delay where the flyout opens after the user sees the page.

Copy link
Member

Choose a reason for hiding this comment

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

@devanathan-vaithiyanathan if you do it via IUIViewLifeCycleEvents does ethat cause less delay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@PureWeen , PhoneFlyoutPageRenderer is derived from UIViewController, not UIView. Therefore, overriding MovedToWindow isn’t possible, and invoking the MovedToWindow event handler isn’t applicable in this case.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

Choose a reason for hiding this comment

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

remove the changes to this file

You can fix this by adding a REMOVE inside the unshipped

or you can use the cake script for this locally

dotnet cake --target=publicapi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@PureWeen , Thanks for the suggestion. I’ve moved the changes from Shipped to Unshipped.

@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in MAUI SDK Ongoing Sep 24, 2025
@rmarinho rmarinho merged commit 082d25a into dotnet:main Oct 5, 2025
126 of 130 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Oct 5, 2025
rmarinho added a commit that referenced this pull request Oct 18, 2025
* [Testing] Fix for flaky UITests CookiesCorrectlyLoadWithMultipleWebViews in CI (#31823)

This PR addresses the UI test image failures that occurred in the main
branch and includes updates to improve rendering and test stability
across platforms.

- In the CookiesCorrectlyLoadWithMultipleWebViews test case, I changed
the WebView source to match the cookies.

### Test cases:

- CookiesCorrectlyLoadWithMultipleWebViews

* [iOS] Fix added for Navigation.SetTitleView does not work in ios 26. (#31831)

* [iOS] Fix added for Navigation.SetTitleView does not work in ios 26.

* changes added.

* changed the version condition.

* [testing] Update androidApiLevels for device tests (#31827)

* Update androidApiLevels for device tests

* [ci] Update provisioning of api 36

* Add reference (#31669)

* [Windows, Catalyst] Fix IsPresented=true Not Working on Initial Value in FlyoutPage (#31515)

* mac fix added

* Windows fix added

* test case added

* Update Issue31372.cs

* Update Issue31372.cs

* Update WindowHandler.iOS.cs

* fix updated

* Update WindowHandler.iOS.cs

* Update WindowHandler.iOS.cs

* Update PublicAPI.Shipped.txt

* changes added in UnShipped file

* Temporarily disable flaky WebView tests using FlakyTest attribute (#31868)

* Initial plan

* Temporarily disable flaky WebView tests with FlakyTest attribute

Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>

* Add tracking issue link to FlakyTest attributes

Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>

* Invert NavigationPage UseMauiHandler flag (#31859)

* Update dependencies from https://github.com/dotnet/xharness build 20251004.2 (#31872)

On relative base path root
Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit From Version 9.0.0-prerelease.25426.1 -> To Version 9.0.0-prerelease.25504.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* [release/9.0.1xx-sr12] Fix ProjectList not displaying due to missing BindingContext update in template sample (#31954)

* update ProjectListPage

* Update MauiApp.1.csproj

---------

Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>

* [release/9.0.1xx-sr12] [Android] -Picker dialog causes crash when page is popped while dialo… (#31919)

* [Android] -Picker dialog causes crash when page is popped while dialog is open

* removed the dispose call.

* Revert "removed the dispose call."

This reverts commit e1e7a9f.

* removed the dispose call.

* Modified with Dismiss() method.

---------

Co-authored-by: sheiksyedm <sheiksyedm@syncfusion.com>

* [release/9.0.1xx-sr12] [iOS] Fix memory leak in CollectionViewHandler2 ItemsLayout PropertyChanged subscription (#31922)

* [release/9.0.1xx-sr12] [Android][Regression] Fixed Entry and Editor AppThemeBinding colors for text and placeholder reset to default on theme change (#31921)

* added snapshots and fix

* removed test cases

* added the test cases and snapshots

* added braces

* added mac and windows snapshots

* added mac and windows snapshots

* added snapshot

---------

Co-authored-by: TamilarasanSF4853 <tamilarasan.velu@syncfusion.com>

* 9.0.120 Release Branding (#31979)

* [release/9.0.1xx-sr12] [ci] Update arcade main (#31987)

* Update arcade

* Don t use internal feeds

---------

Co-authored-by: Rui Marinho <me@ruimarinho.net>

* Update FlyoutViewHandler.Windows.cs (#32007)

Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>

---------

Co-authored-by: TamilarasanSF4853 <tamilarasan.velu@syncfusion.com>
Co-authored-by: sheiksyedm <sheiksyedm@syncfusion.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com>
Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
Co-authored-by: Tim Miller <drasticactions@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-flyout Flyout community ✨ Community Contribution p/0 Work that we can't release without partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Windows, Catalyst] IsPresented=true Not Working on Initial Value in FlyoutPage

4 participants