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 @@ -82,6 +82,7 @@ public ShellToolbarTracker(IShellContext shellContext, AToolbar toolbar, DrawerL
((IShellController)ShellContext.Shell).AddFlyoutBehaviorObserver(this);
ShellContext.Shell.Toolbar.PropertyChanged += OnToolbarPropertyChanged;
ShellContext.Shell.Navigated += OnShellNavigated;
ShellContext.Shell.PropertyChanged += HandleShellPropertyChanged;
}

void IShellToolbarTracker.SetToolbar(IToolbar toolbar)
Expand Down Expand Up @@ -182,6 +183,7 @@ protected override void Dispose(bool disposing)
((IShellController)ShellContext.Shell)?.RemoveFlyoutBehaviorObserver(this);
ShellContext.Shell.Toolbar.PropertyChanged -= OnToolbarPropertyChanged;
ShellContext.Shell.Navigated -= OnShellNavigated;
ShellContext.Shell.PropertyChanged -= HandleShellPropertyChanged;
UpdateTitleView(ShellContext.AndroidContext, _platformToolbar, null);

if (_searchView != null)
Expand Down Expand Up @@ -280,6 +282,12 @@ void OnShellNavigated(object sender, ShellNavigatedEventArgs e)
}
}

void HandleShellPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.Is(Shell.FlyoutIconProperty))
UpdateLeftBarButtonItem();
}

BackButtonBehavior _backButtonBehavior = null;
protected virtual void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ protected virtual void HandleShellPropertyChanged(object sender, PropertyChanged
{
if (e.Is(VisualElement.FlowDirectionProperty))
UpdateFlowDirection();
else if (e.Is(Shell.FlyoutIconProperty))
UpdateLeftToolbarItems();
}

protected virtual void OnBackButtonBehaviorPropertyChanged(object sender, PropertyChangedEventArgs e)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue20166.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue20166"
FlyoutIcon="groceries.png">
<FlyoutItem>
<ShellContent Title="Page 1">
<ContentPage Shell.FlyoutBehavior="Flyout">
<Button Text="Switch to page 2" AutomationId="button1" Clicked="Button1_Clicked"/>
</ContentPage>
</ShellContent>
<ShellContent x:Name="shellTab2" Title="Page 2">
<ContentPage Shell.FlyoutBehavior="Disabled"/>
</ShellContent>
</FlyoutItem>
</Shell>
24 changes: 24 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue20166.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.ComponentModel;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 20166, "Custom FlyoutIcon visible although FlyoutBehavior set to disabled", PlatformAffected.Android | PlatformAffected.iOS)]
public partial class Issue20166 : Shell
{
public Issue20166()
{
InitializeComponent();
}

void Button1_Clicked(System.Object sender, System.EventArgs e)
{
CurrentItem = shellTab2;
Current.FlyoutIcon = String.Empty;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

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

public override string Issue => "Custom FlyoutIcon visible although FlyoutBehavior set to disabled";

[Test]
[Category(UITestCategories.FlyoutPage)]
public void ShouldHideCustomFlyoutIconWhenNavigatingToPageWithDisabledFlyout()
Comment thread
kubaflo marked this conversation as resolved.
{
// Click button 1 to switch to the page with disabled flyout
_ = App.WaitForElement("button1");
App.Click("button1");

// 2. Verify that the flyout icon is not rendered.
VerifyScreenshot();
}
}
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.