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 @@ -40,6 +40,9 @@ internal static void PropagatePropertyChanged(string propertyName, Element eleme

if (propertyName == null || propertyName == Shell.NavBarVisibilityAnimationEnabledProperty.PropertyName)
BaseShellItem.PropagateFromParent(Shell.NavBarVisibilityAnimationEnabledProperty, element);

if (propertyName == null || propertyName == Shell.BackButtonBehaviorProperty.PropertyName)
BaseShellItem.PropagateFromParent(Shell.BackButtonBehaviorProperty, element);

foreach (var child in children.ToArray())
{
Expand Down
56 changes: 56 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28570.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 28570, "Setting BackButtonBehavior to not visible or not enabled does not work")]
public class Issue28570 : Shell
{
public Issue28570()
{
// Register the routes
Routing.RegisterRoute("Issue28570DetailPage", typeof(Issue28570DetailPage));

ContentPage contentPage = new ContentPage
{
Title = "Main Page",
Content = new Button
{
Text = "Go to Detail Page",
AutomationId = "NavigateToDetailButton",
Command = new Command(async () => await Shell.Current.GoToAsync("Issue28570DetailPage"))
}
};

BackButtonBehavior backButtonBehavior = new BackButtonBehavior
{
IsVisible = false,
TextOverride = "BackButton"
};

SetBackButtonBehavior(this, backButtonBehavior);

// Create and add Shell contents
var page1 = new ShellContent
{
Title = "Page 1",
Content = contentPage
};

Items.Add(page1);
}
}

public class Issue28570DetailPage : ContentPage
{
public Issue28570DetailPage()
{
Title = "Detail page";

Content = new VerticalStackLayout()
{
new Label()
{
AutomationId = "HelloLabel",
Text = "Hello, from the detail page",
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue28570 : _IssuesUITest
{
public Issue28570(TestDevice testDevice) : base(testDevice) { }

public override string Issue => "Setting BackButtonBehavior to not visible or not enabled does not work";

[Test]
[Category(UITestCategories.Shell)]
[Category(UITestCategories.Navigation)]
public void BackButtonShouldNotBeVisible()
{
App.WaitForElement("NavigateToDetailButton");
App.Click("NavigateToDetailButton");
App.WaitForElement("HelloLabel");
App.WaitForNoElement("BackButton");
}
}
Loading