Skip to content

Commit

Permalink
Update NavigationPageToolbar.cs
Browse files Browse the repository at this point in the history
The condition to show the flyout button (burger) or not is set in method ShouldShowToolbarButton of the FlyoutPage.
In Android, this method is not hit when orientation changes. This method is only called once during initialization.

This modification triggers the update of this button when orientation changes.

dotnet#24468
  • Loading branch information
guyvaio authored Aug 27, 2024
1 parent aa1632a commit 00befba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,20 @@ void OnToolbarItemsChanged(object sender, EventArgs e)
ToolbarItems = _toolbarTracker.ToolbarItems;
}

#if ANDROID
Devices.DisplayOrientation lastOrientation = Devices.DisplayOrientation.Unknown;
#endif

void OnPagePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
#if ANDROID
if ((e.PropertyName == "Height") && (Parent is FlyoutPage) && (lastOrientation != Devices.DeviceDisplay.MainDisplayInfo.Orientation))
{
if (lastOrientation != Devices.DisplayOrientation.Unknown)
UpdateBackButton();
lastOrientation = Devices.DeviceDisplay.MainDisplayInfo.Orientation;
}
#endif
if (e.IsOneOf(NavigationPage.HasNavigationBarProperty,
NavigationPage.HasBackButtonProperty,
NavigationPage.TitleIconImageSourceProperty,
Expand Down

0 comments on commit 00befba

Please sign in to comment.