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
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
Preview

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

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

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

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

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
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: Approved
Development

Successfully merging this pull request may close these issues.

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