Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Fix FlyoutPage ShouldShowToolbarButton when overridden to return false, still shows button in title bar #25857

Merged
merged 5 commits into from
Jan 10, 2025
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 @@ -35,6 +35,10 @@ public static void UpdateBackButton(this MauiToolbar platformToolbar, Toolbar to
platformToolbar.IsBackEnabled =
toolbar.BackButtonEnabled && toolbar.BackButtonVisible;

// Adjusts WinUI TogglePaneButton visibility based on DrawerToggleVisible setting.
if (platformToolbar.TogglePaneButton is not null)
platformToolbar.TogglePaneButton.Visibility = toolbar.DrawerToggleVisible ? UI.Xaml.Visibility.Visible : UI.Xaml.Visibility.Collapsed;

platformToolbar
.IsBackButtonVisible = (toolbar.BackButtonVisible) ? NavigationViewBackButtonVisible.Visible : NavigationViewBackButtonVisible.Collapsed;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24547.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 24547, "[Windows] FlyoutPage ShouldShowToolbarButton when overridden to return false, still shows button in title bar", PlatformAffected.UWP)]
public class Issue24547PopoverPage : FlyoutPage
{
public Issue24547PopoverPage()
{
FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover;

Flyout = new ContentPage
{
Title = "Flyout",
BackgroundColor = Colors.Red,
Content = new StackLayout
{
Children = {
new Label { Text = "Flyout" }
}
}
};

ContentPage contentPage = new ContentPage
{
BackgroundColor = Colors.Green,
Title = "Detail",
Content = new StackLayout
{
Children =
{
CreateDetailButton()
}
}
};

Detail = new NavigationPage(contentPage);
Button button = new Button() { Text = "Menu", AutomationId = "MenuButton" };
button.Clicked += (s, e) => IsPresented = true;
NavigationPage.SetTitleView(contentPage, button);
}

private Button CreateDetailButton()
{
Button button = new Button
{
Text = "Detail",
AutomationId = "DetailButton"
};

return button;
}

public override bool ShouldShowToolbarButton()
{
return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#if !MACCATALYST
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;
public class Issue24547: _IssuesUITest
{
public Issue24547(TestDevice device) : base(device) { }

public override string Issue => "[Windows] FlyoutPage ShouldShowToolbarButton when overridden to return false, still shows button in title bar";

[Test]
[Category(UITestCategories.FlyoutPage)]
public void VerifyInitialToolbarButtonHidden()
{
App.WaitForElement("DetailButton");
VerifyScreenshot();
}
}
#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading