Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
UpdateBackground();
else if (e.PropertyName == PlatformConfiguration.iOSSpecific.FlyoutPage.ApplyShadowProperty.PropertyName)
UpdateApplyShadow(((FlyoutPage)Element).OnThisPlatform().GetApplyShadow());
else if (e.PropertyName == Microsoft.Maui.Controls.FlyoutPage.FlyoutLayoutBehaviorProperty.PropertyName)
UpdateFlyoutLayoutBehaviorChanges();
else if (e.PropertyName == PlatformConfiguration.iOSSpecific.Page.PrefersHomeIndicatorAutoHiddenProperty.PropertyName ||
e.PropertyName == PlatformConfiguration.iOSSpecific.Page.PrefersStatusBarHiddenProperty.PropertyName)
UpdatePageSpecifics();
Expand Down Expand Up @@ -476,6 +478,26 @@ void LayoutChildren(bool animated)
UpdateClickOffViewFrame();
}

void UpdateFlyoutLayoutBehaviorChanges()
{
LayoutChildren(true);
FlyoutPage flyoutPage = Element as FlyoutPage;
if (flyoutPage == null)
return;
FlyoutLayoutBehavior flyoutBehavior = FlyoutPage.FlyoutLayoutBehavior;
bool shouldPresent = FlyoutPageController.ShouldShowSplitMode;
if (flyoutBehavior == FlyoutLayoutBehavior.Popover || flyoutBehavior == FlyoutLayoutBehavior.Default)
{
shouldPresent = false;
}

if (shouldPresent != flyoutPage.IsPresented)
{
((IElementController)Element).SetValueFromRenderer(FlyoutPage.IsPresentedProperty, shouldPresent);
UpdateLeftBarButton();
}
}

void PackContainers()
{
_detailController.View.BackgroundColor = new UIColor(1, 1, 1, 1);
Expand Down
56 changes: 56 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue18158.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;

namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 18158, "FlyoutPage does not respond to changes in the FlyoutLayoutBehavior property", PlatformAffected.iOS)]
public class Issue18158 : TestFlyoutPage
{
Button _button;
protected override void Init()
{
_button = new Button{ Text="Click", AutomationId = "Button"};
FlyoutLayoutBehavior = FlyoutLayoutBehavior.Split;
// Define the Flyout page
Flyout = new ContentPage
{
Title = "Menu",

Content = new StackLayout
{
Children =
{
_button,
}
}
};

_button.Clicked += (s,e) =>
{
if (this.FlyoutLayoutBehavior == FlyoutLayoutBehavior.Split)
{
this.FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover;
}
else
{
this.FlyoutLayoutBehavior = FlyoutLayoutBehavior.Split;
}
};


// Define the Detail page
Detail = new NavigationPage(new ContentPage
{
Title = "Detail Page",
Content = new StackLayout
{
Children =
{
new Label { Text = "Welcome to the Detail Page!", AutomationId = "Label" },
}
}
});

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_IOS //FlyoutLayoutBehavior changes are not supported on Android and iOS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue18158 : _IssuesUITest
{
public Issue18158(TestDevice device)
: base(device)
{ }

public override string Issue => "FlyoutPage does not respond to changes in the FlyoutLayoutBehavior property";

[Test]
[Category(UITestCategories.FlyoutPage)]
public void VerifyFlyoutLayoutBehaviorChanges()
{
App.WaitForElement("Button");
App.Tap("Button");
App.WaitForElement("Label");
App.WaitForNoElement("Button");
}
}

#endif