diff --git a/docs/design/ToolbarDrawerToggle.md b/docs/design/ToolbarDrawerToggle.md new file mode 100644 index 000000000000..4b397fa9ecd5 --- /dev/null +++ b/docs/design/ToolbarDrawerToggle.md @@ -0,0 +1,103 @@ +# Toolbar drawer toggle contract + +`Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible` tells a platform backend whether the +toolbar should render the drawer (flyout / "hamburger") affordance in its navigation slot. + +## Why a separate interface + +The member is **not** on `IToolbar`. `IToolbar` is a shipped public interface, and adding a member to it +would source-break every existing external implementer on `netstandard2.0`, where default interface +members are not supported and the member would therefore be abstract (`CS0535`). + +`IToolbarDrawerToggleVisible` is an optional capability interface instead, so it is purely additive on +every target framework. This mirrors `ISwipeItemMenuItemIconColor`, which was added alongside +`ISwipeItemMenuItem` for the same reason. + +Consume it by pattern matching: + +```csharp +bool drawerToggleVisible = toolbar is IToolbarDrawerToggleVisible { DrawerToggleVisible: true }; +``` + +A toolbar that does not implement the interface has no drawer toggle. + +## Ownership + +The value is **computed and owned by the cross-platform layer**, which is why the contract is read-only: + +| Toolbar | How the value is computed | +| ------- | ------------------------- | +| `ShellToolbar` | `FlyoutBehavior == Flyout` and either the navigation stack has a single page or the back button is suppressed by a `BackButtonBehavior`. On Windows only `FlyoutBehavior == Flyout` is considered. | +| `NavigationPageToolbar` | The toolbar's parent is a `FlyoutPage`, `FlyoutPage.ShouldShowToolbarButton()` is `true`, and (outside Windows) no page has been pushed. | + +Platform backends **render** this value; they must not compute or overwrite it. +`Microsoft.Maui.Controls.Toolbar` still exposes a settable `DrawerToggleVisible` property because it is +shipped public API, but the framework owns the value for the Shell and `NavigationPage` toolbars. + +## Back button precedence — not mutual exclusion + +`BackButtonVisible` and `DrawerToggleVisible` are **not** mutually exclusive. On Windows, `ShellToolbar` +sets the drawer toggle purely from `FlyoutBehavior`, so both values can be `true` at the same time. + +What is guaranteed is **precedence**: the two share a single navigation slot, and the back button wins. +A backend should check the back button first and only fall through to the drawer toggle, exactly as the +built-in `ToolbarExtensions.UpdateBackButton` implementations do on Android and Tizen. + +Ordering is also guaranteed: the drawer toggle backing value is updated *before* `BackButtonVisible` +notifies, and the `DrawerToggleVisible` notification is raised *after* it. So a backend rendering the +shared slot from either mapper always observes a settled pair rather than a half-applied transition. +For the same reason, code that forwards toolbar state between instances must assign `BackButtonVisible` +before `DrawerToggleVisible` (see `ShellToolbarTracker.ApplyToolbarChanges`). + +## Change notification + +Changes raise a handler update keyed on `"DrawerToggleVisible"`, exactly like any other toolbar property: + +```csharp +public class MyToolbarHandler : ElementHandler +{ + public static readonly IPropertyMapper Mapper = + new PropertyMapper(ElementMapper) + { + [nameof(IToolbar.Title)] = MapTitle, + [nameof(IToolbar.BackButtonVisible)] = MapNavigationSlot, + [nameof(IToolbarDrawerToggleVisible.DrawerToggleVisible)] = MapNavigationSlot, + }; + + public MyToolbarHandler() : base(Mapper) { } + + protected override MyPlatformToolbar CreatePlatformElement() => new(); + + static void MapTitle(MyToolbarHandler handler, IToolbar toolbar) => + handler.PlatformView.Title = toolbar.Title; + + static void MapNavigationSlot(MyToolbarHandler handler, IToolbar toolbar) + { + if (toolbar.BackButtonVisible) // back wins + handler.PlatformView.ShowBackButton(); + else if (toolbar is IToolbarDrawerToggleVisible { DrawerToggleVisible: true }) + handler.PlatformView.ShowDrawerToggle(); + else + handler.PlatformView.ClearNavigationSlot(); + } +} +``` + +Pointing both keys at one method is the recommended shape, since the two properties render into the same +slot. + +Each window owns its own toolbar instance, so drawer toggle state and its notifications are tracked per +window with no additional work from the backend. + +## Built-in platform consumption + +| Platform | Consumes `DrawerToggleVisible`? | Where | +| -------- | ------------------------------- | ----- | +| Android | Yes | `Controls.Platform.ToolbarExtensions.UpdateBackButton` selects a `DrawerArrowDrawable` with `Progress = 0` when the back button is hidden and the drawer toggle is visible. Shell additionally drives an `ActionBarDrawerToggle` from `ShellToolbarTracker`. | +| Tizen | Yes | `Controls.Platform.ToolbarExtensions.UpdateBackButton` installs a menu button, and `UpdateTitleIcon` avoids clearing the icon while the drawer toggle is visible. | +| Windows | No | The flyout toggle is rendered by `NavigationView`, not by the toolbar. | +| iOS / MacCatalyst | No | The flyout toggle is owned by the flyout/navigation controller, not by the toolbar. | + +The `DrawerToggleVisible` property mapping is therefore registered only for Android and Tizen. Because +that mapping and the `BackButtonVisible` mapping both call `UpdateBackButton`, a change that flips both +values runs it twice; this is intentional and idempotent. diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs index 88a70c63f7cb..e38eb8f93288 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs @@ -585,8 +585,7 @@ internal static void ApplyToolbarChanges(Toolbar shellToolbar, Toolbar destinati destination.Title = shellToolbar.Title; destination.TitleView = shellToolbar.TitleView; destination.DynamicOverflowEnabled = shellToolbar.DynamicOverflowEnabled; - destination.DrawerToggleVisible = shellToolbar.DrawerToggleVisible; - destination.BackButtonVisible = shellToolbar.BackButtonVisible; + shellToolbar.ForwardNavigationIconStateTo(destination); destination.BackButtonEnabled = shellToolbar.BackButtonEnabled; destination.IsVisible = shellToolbar.IsVisible; } diff --git a/src/Controls/src/Core/Handlers/Shell/Tizen/ShellView.cs b/src/Controls/src/Core/Handlers/Shell/Tizen/ShellView.cs index 5220a30c0e1d..b870381f8e80 100644 --- a/src/Controls/src/Core/Handlers/Shell/Tizen/ShellView.cs +++ b/src/Controls/src/Core/Handlers/Shell/Tizen/ShellView.cs @@ -103,7 +103,7 @@ public void SetElement(Shell shell, IMauiContext context) { if (e.PropertyName == "BackButtonVisible") { - UpdateDrawerToggleVisible(); + RefreshNavigationSlot(); } }; @@ -119,7 +119,7 @@ public void SetElement(Shell shell, IMauiContext context) public void UpdateFlyoutBehavior(FlyoutBehavior flyoutBehavior) { _navigationDrawer.DrawerBehavior = flyoutBehavior.ToPlatform(); - UpdateDrawerToggleVisible(); + RefreshNavigationSlot(); if (_navigationDrawer.DrawerBehavior == TDrawerBehavior.Drawer) _ = _navigationDrawer.CloseAsync(false); @@ -441,9 +441,10 @@ void OnIconPressed(object? sender, EventArgs e) IsOpened = true; } - void UpdateDrawerToggleVisible() + // DrawerToggleVisible is computed and owned by ShellToolbar, which already accounts for + // FlyoutBehavior and the back button, so this only re-renders the navigation slot. + void RefreshNavigationSlot() { - Element!.Toolbar.DrawerToggleVisible = ((Element!.Toolbar.DrawerToggleVisible) && (Element.FlyoutBehavior == FlyoutBehavior.Flyout)); _toolbar?.UpdateBackButton(Element!.Toolbar); } diff --git a/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs b/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs index 171c651403ca..ae5d44377c3b 100644 --- a/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs +++ b/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs @@ -182,14 +182,14 @@ void UpdateBackButton() // Set this before BackButtonVisible triggers an update to the handler // This way all useful information is present - if (Parent is FlyoutPage flyout && flyout.ShouldShowToolbarButton() + var drawerToggleVisible = Parent is FlyoutPage flyout && flyout.ShouldShowToolbarButton() #if !WINDOWS // TODO NET 10 : Move this logic to ShouldShowToolbarButton && !anyPagesPushed.Value #endif - ) - _drawerToggleVisible = true; - else - _drawerToggleVisible = false; + ; + + var drawerToggleVisibleChanged = _drawerToggleVisible != drawerToggleVisible; + _drawerToggleVisible = drawerToggleVisible; // Once we have better logic inside core to handle backbutton visiblity this // code should all go away. @@ -219,6 +219,11 @@ void UpdateBackButton() _userChanged = false; } + + // Notified last so that BackButtonVisible (which takes precedence in the navigation slot) + // is already up to date when platform backends react to the drawer toggle change. + if (drawerToggleVisibleChanged) + NotifyPropertyChanged(nameof(DrawerToggleVisible)); } void ApplyChanges(NavigationPage navigationPage) diff --git a/src/Controls/src/Core/Platform/Tizen/Extensions/ToolbarExtensions.cs b/src/Controls/src/Core/Platform/Tizen/Extensions/ToolbarExtensions.cs index 0cb0d61ab4e9..01df4d8f87a6 100644 --- a/src/Controls/src/Core/Platform/Tizen/Extensions/ToolbarExtensions.cs +++ b/src/Controls/src/Core/Platform/Tizen/Extensions/ToolbarExtensions.cs @@ -34,6 +34,11 @@ public static void UpdateIsVisible(this MauiToolbar platformToolbar, Toolbar too } public static void UpdateTitleIcon(this MauiToolbar platformToolbar, Toolbar toolbar) + { + platformToolbar.UpdateTitleIcon(toolbar, toolbar.BeginNavigationIconUpdate()); + } + + static void UpdateTitleIcon(this MauiToolbar platformToolbar, Toolbar toolbar, int generation) { _ = toolbar?.Handler?.MauiContext ?? throw new ArgumentNullException(nameof(toolbar.Handler.MauiContext)); @@ -50,7 +55,7 @@ public static void UpdateTitleIcon(this MauiToolbar platformToolbar, Toolbar too source.LoadImage(toolbar.Handler.MauiContext, (result) => { - if (result?.Value != null) + if (result?.Value != null && toolbar.IsCurrentTitleIconUpdate(generation, source)) { var image = new TImage { @@ -63,21 +68,23 @@ public static void UpdateTitleIcon(this MauiToolbar platformToolbar, Toolbar too public static void UpdateBackButton(this MauiToolbar platformToolbar, Toolbar toolbar) { - if (toolbar.BackButtonVisible) + var generation = toolbar.BeginNavigationIconUpdate(); + + if (toolbar.NavigationIconKind == ToolbarNavigationIconKind.BackButton) { var backButton = CreateBackButton(platformToolbar, toolbar); backButton.Clicked += (s, e) => platformToolbar.SendIconPressed(); platformToolbar.Icon = backButton; } - else if (toolbar.DrawerToggleVisible) + else if (toolbar.NavigationIconKind == ToolbarNavigationIconKind.DrawerToggle) { var menuButton = CreateMenuButton(platformToolbar, toolbar); menuButton.Clicked += (s, e) => platformToolbar.SendIconPressed(); platformToolbar.Icon = menuButton; } - else if (toolbar.TitleIcon == null) + else { - platformToolbar.Icon = null; + platformToolbar.UpdateTitleIcon(toolbar, generation); } } diff --git a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt index c1c1d43e12e4..ced2663e1eca 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -321,4 +321,6 @@ virtual Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedConte ~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty +static Microsoft.Maui.Controls.Toolbar.MapDrawerToggleVisible(Microsoft.Maui.Handlers.IToolbarHandler! arg1, Microsoft.Maui.Controls.Toolbar! arg2) -> void +static Microsoft.Maui.Controls.Toolbar.MapDrawerToggleVisible(Microsoft.Maui.Handlers.ToolbarHandler! arg1, Microsoft.Maui.Controls.Toolbar! arg2) -> void static Microsoft.Maui.Controls.Shell.ResolveFlyoutItemTemplate(Microsoft.Maui.Controls.Shell? shell, Microsoft.Maui.Controls.BindableObject! flyoutItem) -> Microsoft.Maui.Controls.DataTemplate? diff --git a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index 59c3d26a53d3..80c1aa5cef2e 100644 --- a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -225,4 +225,6 @@ Microsoft.Maui.Controls.Label.~Label() -> void ~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.TabbedPage.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty +static Microsoft.Maui.Controls.Toolbar.MapDrawerToggleVisible(Microsoft.Maui.Handlers.IToolbarHandler! handler, Microsoft.Maui.Controls.Toolbar! toolbar) -> void +static Microsoft.Maui.Controls.Toolbar.MapDrawerToggleVisible(Microsoft.Maui.Handlers.ToolbarHandler! handler, Microsoft.Maui.Controls.Toolbar! toolbar) -> void static Microsoft.Maui.Controls.Shell.ResolveFlyoutItemTemplate(Microsoft.Maui.Controls.Shell? shell, Microsoft.Maui.Controls.BindableObject! flyoutItem) -> Microsoft.Maui.Controls.DataTemplate? diff --git a/src/Controls/src/Core/ShellToolbar.cs b/src/Controls/src/Core/ShellToolbar.cs index 0f8429663147..2fe891b9b4e8 100644 --- a/src/Controls/src/Core/ShellToolbar.cs +++ b/src/Controls/src/Core/ShellToolbar.cs @@ -92,15 +92,23 @@ internal void ApplyChanges() var flyoutBehavior = (_shell as IFlyoutView).FlyoutBehavior; #if WINDOWS - _drawerToggleVisible = flyoutBehavior is FlyoutBehavior.Flyout; + var drawerToggleVisible = flyoutBehavior is FlyoutBehavior.Flyout; #else - _drawerToggleVisible = flyoutBehavior is FlyoutBehavior.Flyout && (stack.Count <= 1 || !backButtonVisible); + var drawerToggleVisible = flyoutBehavior is FlyoutBehavior.Flyout && (stack.Count <= 1 || !backButtonVisible); #endif + var drawerToggleVisibleChanged = _drawerToggleVisible != drawerToggleVisible; + _drawerToggleVisible = drawerToggleVisible; + BackButtonVisible = backButtonVisible && stack.Count > 1; BackButtonEnabled = _backButtonBehavior?.IsEnabled ?? true; BackButtonAccessibilityLabel = _backButtonBehavior?.AccessibilityLabel; ToolbarItems = _toolbarTracker.ToolbarItems; + // Notified after BackButtonVisible (which takes precedence in the navigation slot) so that + // platform backends observe a fully consistent toolbar state. + if (drawerToggleVisibleChanged) + NotifyPropertyChanged(nameof(DrawerToggleVisible)); + UpdateTitle(); Func getDefaultNavBarIsVisible = () => diff --git a/src/Controls/src/Core/Toolbar/Toolbar.Android.cs b/src/Controls/src/Core/Toolbar/Toolbar.Android.cs index 6ac22f77db1b..47426e470f95 100644 --- a/src/Controls/src/Core/Toolbar/Toolbar.Android.cs +++ b/src/Controls/src/Core/Toolbar/Toolbar.Android.cs @@ -200,6 +200,9 @@ public static void MapBackButtonVisible(ToolbarHandler arg1, Toolbar arg2) => public static void MapIsVisible(ToolbarHandler arg1, Toolbar arg2) => MapIsVisible((IToolbarHandler)arg1, arg2); + public static void MapDrawerToggleVisible(ToolbarHandler arg1, Toolbar arg2) => + MapDrawerToggleVisible((IToolbarHandler)arg1, arg2); + public static void MapBarTextColor(IToolbarHandler arg1, Toolbar arg2) @@ -258,6 +261,11 @@ public static void MapIsVisible(IToolbarHandler arg1, Toolbar arg2) arg1.PlatformView.UpdateIsVisible(arg2); } + public static void MapDrawerToggleVisible(IToolbarHandler arg1, Toolbar arg2) + { + arg1.PlatformView.UpdateBackButton(arg2); + } + diff --git a/src/Controls/src/Core/Toolbar/Toolbar.Mapper.cs b/src/Controls/src/Core/Toolbar/Toolbar.Mapper.cs index 51695da23b7e..676eb51512e2 100644 --- a/src/Controls/src/Core/Toolbar/Toolbar.Mapper.cs +++ b/src/Controls/src/Core/Toolbar/Toolbar.Mapper.cs @@ -27,6 +27,13 @@ internal static void RemapForControls() ToolbarHandler.Mapper.ReplaceMapping(nameof(Toolbar.BarBackground), MapBarBackground); ToolbarHandler.Mapper.ReplaceMapping(nameof(Toolbar.BarTextColor), MapBarTextColor); #endif +#if ANDROID || TIZEN + // Android and Tizen are the only built-in platforms that render the drawer affordance from the + // toolbar itself, in the same navigation slot as the back button, so a drawer toggle change has + // to re-evaluate that slot. Windows, iOS and MacCatalyst render the flyout toggle from the + // flyout/navigation view instead and never read this property. + ToolbarHandler.Mapper.ReplaceMapping(nameof(IToolbarDrawerToggleVisible.DrawerToggleVisible), MapDrawerToggleVisible); +#endif #if WINDOWS ToolbarHandler.Mapper.ReplaceMapping(nameof(Toolbar.BackButtonEnabled), MapBackButtonEnabled); ToolbarHandler.Mapper.ReplaceMapping(PlatformConfiguration.WindowsSpecific.Page.ToolbarPlacementProperty.PropertyName, MapToolbarPlacement); diff --git a/src/Controls/src/Core/Toolbar/Toolbar.Tizen.cs b/src/Controls/src/Core/Toolbar/Toolbar.Tizen.cs index 1fd69543c8fe..863d1c94b405 100644 --- a/src/Controls/src/Core/Toolbar/Toolbar.Tizen.cs +++ b/src/Controls/src/Core/Toolbar/Toolbar.Tizen.cs @@ -41,6 +41,9 @@ public static void MapBackButtonVisible(ToolbarHandler handler, Toolbar toolbar) public static void MapIsVisible(ToolbarHandler handler, Toolbar toolbar) => MapIsVisible((IToolbarHandler)handler, toolbar); + public static void MapDrawerToggleVisible(ToolbarHandler handler, Toolbar toolbar) => + MapDrawerToggleVisible((IToolbarHandler)handler, toolbar); + public static void MapBackButtonAccessibilityLabel(ToolbarHandler handler, Toolbar toolbar) => MapBackButtonAccessibilityLabel((IToolbarHandler)handler, toolbar); @@ -94,6 +97,11 @@ public static void MapIsVisible(IToolbarHandler handler, Toolbar toolbar) handler.PlatformView.UpdateIsVisible(toolbar); } + public static void MapDrawerToggleVisible(IToolbarHandler handler, Toolbar toolbar) + { + handler.PlatformView.UpdateBackButton(toolbar); + } + public static void MapBarBackground(IToolbarHandler handler, Toolbar toolbar) { handler.PlatformView.UpdateBarBackgroundColor(toolbar); diff --git a/src/Controls/src/Core/Toolbar/Toolbar.cs b/src/Controls/src/Core/Toolbar/Toolbar.cs index 38b8571098ac..08daa472be71 100644 --- a/src/Controls/src/Core/Toolbar/Toolbar.cs +++ b/src/Controls/src/Core/Toolbar/Toolbar.cs @@ -4,11 +4,20 @@ using System.ComponentModel; using System.Runtime.CompilerServices; using System.Text; +using System.Threading; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls { - public partial class Toolbar : Maui.IToolbar, INotifyPropertyChanged + internal enum ToolbarNavigationIconKind + { + None, + TitleIcon, + DrawerToggle, + BackButton, + } + + public partial class Toolbar : Maui.IToolbar, Maui.IToolbarDrawerToggleVisible, INotifyPropertyChanged { VisualElement _titleView; string _title; @@ -25,6 +34,7 @@ public partial class Toolbar : Maui.IToolbar, INotifyPropertyChanged bool _backButtonVisible; bool _backButtonEnabled = true; bool _drawerToggleVisible; + int _navigationIconUpdateGeneration; Maui.IElement _parent; IElementHandler _handler; @@ -48,6 +58,39 @@ public Toolbar(Maui.IElement parent) public bool BackButtonEnabled { get => _backButtonEnabled; set => SetProperty(ref _backButtonEnabled, value); } public virtual bool DrawerToggleVisible { get => _drawerToggleVisible; set => SetProperty(ref _drawerToggleVisible, value); } public bool IsVisible { get => _isVisible; set => SetProperty(ref _isVisible, value); } + internal ToolbarNavigationIconKind NavigationIconKind => + BackButtonVisible ? ToolbarNavigationIconKind.BackButton : + DrawerToggleVisible ? ToolbarNavigationIconKind.DrawerToggle : + TitleIcon is not null ? ToolbarNavigationIconKind.TitleIcon : + ToolbarNavigationIconKind.None; + + internal int BeginNavigationIconUpdate() => + Interlocked.Increment(ref _navigationIconUpdateGeneration); + + internal bool IsCurrentTitleIconUpdate(int generation, ImageSource source) => + generation == Volatile.Read(ref _navigationIconUpdateGeneration) && + ReferenceEquals(source, TitleIcon) && + NavigationIconKind == ToolbarNavigationIconKind.TitleIcon; + + internal void ForwardNavigationIconStateTo(Toolbar destination) + { + if (BackButtonVisible) + { + destination.BackButtonVisible = true; + destination.DrawerToggleVisible = DrawerToggleVisible; + } + else if (DrawerToggleVisible) + { + destination.DrawerToggleVisible = true; + destination.BackButtonVisible = false; + } + else + { + destination.BackButtonVisible = false; + destination.DrawerToggleVisible = false; + } + } + public IElementHandler Handler { get => _handler; @@ -77,6 +120,13 @@ private protected void SetProperty(ref T backingStore, T value, return; backingStore = value; + NotifyPropertyChanged(propertyName); + } + + // Used by derived toolbars that assign a backing field directly (to keep a specific update ordering) + // but still need the handler and PropertyChanged subscribers to observe the change afterwards. + private protected void NotifyPropertyChanged(string propertyName) + { Handler?.UpdateValue(propertyName); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } diff --git a/src/Controls/tests/Core.UnitTests/ToolbarDrawerToggleTests.cs b/src/Controls/tests/Core.UnitTests/ToolbarDrawerToggleTests.cs new file mode 100644 index 000000000000..b01ba0193620 --- /dev/null +++ b/src/Controls/tests/Core.UnitTests/ToolbarDrawerToggleTests.cs @@ -0,0 +1,388 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Maui.Devices; +using Microsoft.Maui.Handlers; +using Xunit; + +namespace Microsoft.Maui.Controls.Core.UnitTests +{ + public class ToolbarDrawerToggleTests : ShellTestBase + { + /// + /// Stands in for an out-of-tree platform backend. It is deliberately written against + /// only and never references , so anything it + /// can do here is something an external backend assembly can also do. + /// + class ExternalToolbarBackendHandler : ElementHandler + { + public static readonly IPropertyMapper ExternalMapper = + new PropertyMapper(ElementMapper) + { + [nameof(IToolbar.BackButtonVisible)] = MapBackButtonVisible, + [nameof(IToolbarDrawerToggleVisible.DrawerToggleVisible)] = MapDrawerToggleVisible, + }; + + public ExternalToolbarBackendHandler() + : base(ExternalMapper) + { + } + + public List DrawerToggleUpdates { get; } = new List(); + + public List BackButtonUpdates { get; } = new List(); + + public bool? DrawerToggleVisibleObservedFromBackButtonMapper { get; private set; } + + public void ClearRecordedUpdates() + { + DrawerToggleUpdates.Clear(); + BackButtonUpdates.Clear(); + DrawerToggleVisibleObservedFromBackButtonMapper = null; + } + + protected override object CreatePlatformElement() => new object(); + + /// + /// The only way an external backend reads drawer state: pattern match the optional capability + /// interface off . A toolbar that does not implement it has no drawer toggle. + /// + internal static bool ReadDrawerToggleVisible(IToolbar toolbar) => + toolbar is IToolbarDrawerToggleVisible { DrawerToggleVisible: true }; + + static void MapDrawerToggleVisible(ExternalToolbarBackendHandler handler, IToolbar toolbar) => + handler.DrawerToggleUpdates.Add(ReadDrawerToggleVisible(toolbar)); + + static void MapBackButtonVisible(ExternalToolbarBackendHandler handler, IToolbar toolbar) + { + handler.BackButtonUpdates.Add(toolbar.BackButtonVisible); + handler.DrawerToggleVisibleObservedFromBackButtonMapper = ReadDrawerToggleVisible(toolbar); + } + } + + /// + /// Creates a Shell whose effective is . + /// A Shell built from a single implicit resolves to + /// instead, which would hide the drawer toggle. + /// + TestShell CreateFlyoutShell() + { + var shell = new TestShell(); + shell.Items.Add(CreateShellItem()); + return shell; + } + + static ExternalToolbarBackendHandler AttachExternalBackend(IToolbar toolbar) + { + var handler = new ExternalToolbarBackendHandler(); + handler.SetVirtualView(toolbar); + handler.ClearRecordedUpdates(); + return handler; + } + + [Fact] + public void DrawerToggleVisibleIsReachableFromIToolbar() + { + var shell = CreateFlyoutShell(); + + // An external backend only ever gets handed the IToolbar contract. + IToolbar toolbar = shell.Toolbar; + + var capability = Assert.IsAssignableFrom(toolbar); + Assert.True(capability.DrawerToggleVisible); + + shell.FlyoutBehavior = FlyoutBehavior.Disabled; + Assert.False(capability.DrawerToggleVisible); + } + + /// + /// The capability interface is optional, so an existing external + /// implementation that predates it keeps compiling and simply reports no drawer toggle. + /// This type deliberately does not implement . + /// + [Fact] + public void ToolbarWithoutCapabilityInterfaceReportsNoDrawerToggle() + { + IToolbar toolbar = new LegacyExternalToolbar(); + + Assert.False(toolbar is IToolbarDrawerToggleVisible); + Assert.False(ExternalToolbarBackendHandler.ReadDrawerToggleVisible(toolbar)); + } + + [Fact] + public void ToolbarImplementingCapabilityInterfaceReportsDrawerToggle() + { + IToolbar toolbar = new CapableExternalToolbar { DrawerToggleVisible = true }; + + Assert.True(ExternalToolbarBackendHandler.ReadDrawerToggleVisible(toolbar)); + } + + [Fact] + public void ExternalBackendIsNotifiedWhenFlyoutBehaviorChanges() + { + var shell = CreateFlyoutShell(); + var handler = AttachExternalBackend(shell.Toolbar); + + shell.FlyoutBehavior = FlyoutBehavior.Disabled; + Assert.Equal(new[] { false }, handler.DrawerToggleUpdates); + + shell.FlyoutBehavior = FlyoutBehavior.Flyout; + Assert.Equal(new[] { false, true }, handler.DrawerToggleUpdates); + } + + [Fact] + public void ExternalBackendIsNotNotifiedWhenDrawerToggleIsUnchanged() + { + var shell = CreateFlyoutShell(); + var handler = AttachExternalBackend(shell.Toolbar); + + // Neither Disabled nor Locked shows the drawer toggle, so no update should be pushed. + shell.FlyoutBehavior = FlyoutBehavior.Disabled; + handler.ClearRecordedUpdates(); + + shell.FlyoutBehavior = FlyoutBehavior.Locked; + + Assert.Empty(handler.DrawerToggleUpdates); + } + + [Fact] + public void TizenNavigationSlotRestoresTitleIconWhenDrawerToggleIsHidden() + { + var shell = CreateFlyoutShell(); + var toolbar = shell.Toolbar; + toolbar.TitleIcon = new FileImageSource { File = "title.png" }; + + Assert.Equal(ToolbarNavigationIconKind.DrawerToggle, toolbar.NavigationIconKind); + + shell.FlyoutBehavior = FlyoutBehavior.Disabled; + + Assert.False(toolbar.BackButtonVisible); + Assert.False(toolbar.DrawerToggleVisible); + Assert.Equal(ToolbarNavigationIconKind.TitleIcon, toolbar.NavigationIconKind); + } + + [Theory] + [InlineData(false)] + [InlineData(true)] + public void ForwardingNavigationSlotAvoidsInvalidIntermediateState(bool transitionToBackButton) + { + var source = new Toolbar(null) + { + TitleIcon = new FileImageSource { File = "custom.png" }, + BackButtonVisible = transitionToBackButton, + DrawerToggleVisible = !transitionToBackButton, + }; + var destination = new Toolbar(null) + { + TitleIcon = source.TitleIcon, + BackButtonVisible = !transitionToBackButton, + DrawerToggleVisible = transitionToBackButton, + }; + var observedKinds = new List(); + destination.PropertyChanged += (_, e) => + { + if (e.PropertyName == nameof(Toolbar.BackButtonVisible) || + e.PropertyName == nameof(Toolbar.DrawerToggleVisible)) + { + observedKinds.Add(destination.NavigationIconKind); + } + }; + + source.ForwardNavigationIconStateTo(destination); + + Assert.NotEmpty(observedKinds); + Assert.DoesNotContain(ToolbarNavigationIconKind.None, observedKinds); + Assert.DoesNotContain(ToolbarNavigationIconKind.TitleIcon, observedKinds); + Assert.Equal(source.NavigationIconKind, destination.NavigationIconKind); + } + + [Fact] + public async Task StaleTitleIconLoadIsRejectedAfterNavigationSlotChanges() + { + var toolbar = new Toolbar(null) + { + TitleIcon = new StreamImageSource(), + }; + var source = toolbar.TitleIcon; + var generation = toolbar.BeginNavigationIconUpdate(); + var releaseLoad = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + Assert.True(toolbar.IsCurrentTitleIconUpdate(generation, source)); + Assert.False(toolbar.IsCurrentTitleIconUpdate(generation, new StreamImageSource())); + + var delayedLoad = Task.Run(async () => + { + await releaseLoad.Task; + return toolbar.IsCurrentTitleIconUpdate(generation, source); + }); + + toolbar.DrawerToggleVisible = true; + toolbar.BeginNavigationIconUpdate(); + releaseLoad.SetResult(); + + Assert.False(await delayedLoad); + Assert.Equal(ToolbarNavigationIconKind.DrawerToggle, toolbar.NavigationIconKind); + } + + [Fact] + public async Task BackButtonTakesPrecedenceOverDrawerToggleInShell() + { + var shell = CreateFlyoutShell(); + var toolbar = shell.Toolbar; + + Assert.True(toolbar.DrawerToggleVisible); + Assert.False(toolbar.BackButtonVisible); + + await shell.Navigation.PushAsync(new ContentPage()); + + Assert.True(toolbar.BackButtonVisible); + Assert.False(toolbar.DrawerToggleVisible); + + await shell.Navigation.PopAsync(); + + Assert.False(toolbar.BackButtonVisible); + Assert.True(toolbar.DrawerToggleVisible); + } + + /// + /// BackButtonVisible and DrawerToggleVisible are not mutually exclusive — on Windows + /// both can be true at once. What the framework does guarantee is ordering: the drawer backing value + /// is already current when BackButtonVisible notifies, so a backend that renders the shared + /// navigation slot from either mapper always sees a settled pair and can apply back-button precedence. + /// + [Fact] + public async Task DrawerToggleValueIsCurrentWhenBackButtonMapperRuns() + { + var shell = CreateFlyoutShell(); + var handler = AttachExternalBackend(shell.Toolbar); + + await shell.Navigation.PushAsync(new ContentPage()); + + // On this (non-Windows) configuration ShellToolbar hides the drawer toggle once a page is + // pushed, and the back button mapper observes that settled value rather than a stale true. + Assert.False(handler.DrawerToggleVisibleObservedFromBackButtonMapper); + Assert.Equal(new[] { false }, handler.DrawerToggleUpdates); + Assert.Equal(new[] { true }, handler.BackButtonUpdates); + } + + [Fact] + public async Task DrawerToggleTransitionsForNavigationPageInsideFlyoutPage() + { + DeviceInfo.SetCurrent(new MockDeviceInfo(idiom: DeviceIdiom.Phone)); + + var navigationPage = new NavigationPage(new ContentPage()); + var flyoutPage = new FlyoutPage + { + Flyout = new ContentPage { Title = "Flyout" }, + Detail = navigationPage + }; + + _ = new TestWindow(flyoutPage); + + var toolbar = flyoutPage.Toolbar; + Assert.NotNull(toolbar); + Assert.True(toolbar.DrawerToggleVisible); + + await navigationPage.Navigation.PushAsync(new ContentPage()); + Assert.True(toolbar.BackButtonVisible); + Assert.False(toolbar.DrawerToggleVisible); + + await navigationPage.Navigation.PopAsync(); + Assert.False(toolbar.BackButtonVisible); + Assert.True(toolbar.DrawerToggleVisible); + } + + [Fact] + public async Task ExternalBackendIsNotifiedForNavigationPageInsideFlyoutPage() + { + DeviceInfo.SetCurrent(new MockDeviceInfo(idiom: DeviceIdiom.Phone)); + + var navigationPage = new NavigationPage(new ContentPage()); + var flyoutPage = new FlyoutPage + { + Flyout = new ContentPage { Title = "Flyout" }, + Detail = navigationPage + }; + + _ = new TestWindow(flyoutPage); + + var handler = AttachExternalBackend(flyoutPage.Toolbar); + + await navigationPage.Navigation.PushAsync(new ContentPage()); + Assert.Equal(new[] { false }, handler.DrawerToggleUpdates); + + await navigationPage.Navigation.PopAsync(); + Assert.Equal(new[] { false, true }, handler.DrawerToggleUpdates); + } + + [Fact] + public void DrawerToggleIsHiddenWhenFlyoutPageIsSplit() + { + DeviceInfo.SetCurrent(new MockDeviceInfo(idiom: DeviceIdiom.Tablet)); + DeviceDisplay.SetCurrent(new MockDeviceDisplay()); + + var navigationPage = new NavigationPage(new ContentPage()); + var flyoutPage = new FlyoutPage + { + FlyoutLayoutBehavior = FlyoutLayoutBehavior.Split, + Flyout = new ContentPage { Title = "Flyout" }, + Detail = navigationPage + }; + + _ = new TestWindow(flyoutPage); + + var toolbar = flyoutPage.Toolbar; + Assert.False(toolbar.DrawerToggleVisible); + + flyoutPage.FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover; + Assert.True(toolbar.DrawerToggleVisible); + } + + [Fact] + public void DrawerToggleStateIsTrackedPerWindow() + { + var firstShell = CreateFlyoutShell(); + var secondShell = CreateFlyoutShell(); + + var firstHandler = AttachExternalBackend(firstShell.Toolbar); + var secondHandler = AttachExternalBackend(secondShell.Toolbar); + + firstShell.FlyoutBehavior = FlyoutBehavior.Disabled; + + Assert.NotSame(firstShell.Toolbar, secondShell.Toolbar); + Assert.False(firstShell.Toolbar.DrawerToggleVisible); + Assert.True(secondShell.Toolbar.DrawerToggleVisible); + Assert.Equal(new[] { false }, firstHandler.DrawerToggleUpdates); + Assert.Empty(secondHandler.DrawerToggleUpdates); + } + + /// Models an external toolbar written before the capability interface existed. + class LegacyExternalToolbar : IToolbar + { + public bool BackButtonVisible { get; set; } + + public bool IsVisible { get; set; } + + public string Title => string.Empty; + + public IElement Parent => null; + + public IElementHandler Handler { get; set; } + } + + /// Models an external toolbar that opts into the capability interface. + class CapableExternalToolbar : IToolbar, IToolbarDrawerToggleVisible + { + public bool BackButtonVisible { get; set; } + + public bool IsVisible { get; set; } + + public bool DrawerToggleVisible { get; set; } + + public string Title => string.Empty; + + public IElement Parent => null; + + public IElementHandler Handler { get; set; } + } + } +} diff --git a/src/Core/src/Core/IToolbar.cs b/src/Core/src/Core/IToolbar.cs index 85614a0acb13..7d83101d0123 100644 --- a/src/Core/src/Core/IToolbar.cs +++ b/src/Core/src/Core/IToolbar.cs @@ -20,4 +20,37 @@ public interface IToolbar : IElement /// string Title { get; } } + + /// + /// Provides the visibility of the drawer (flyout) toggle affordance for an , + /// commonly rendered as a "hamburger" button in the toolbar's navigation slot. + /// + /// + /// This is a separate optional interface to preserve compatibility for existing + /// implementations, including netstandard2.0 targets where adding the member + /// to the existing interface would require implementers to add it. + /// Consume it by pattern matching on an : + /// if (toolbar is IToolbarDrawerToggleVisible { DrawerToggleVisible: true }). A toolbar that + /// does not implement this interface has no drawer toggle. + /// + public interface IToolbarDrawerToggleVisible + { + /// + /// Gets a value that indicates whether the drawer (flyout) toggle affordance should be displayed + /// in the navigation slot of the toolbar. + /// + /// + /// The value is computed and owned by the cross-platform layer (for example Shell, or a + /// NavigationPage hosted inside a FlyoutPage) from the current flyout behavior and + /// navigation stack, which is why this contract is read-only. Platform backends should render it, + /// not compute or overwrite it. + /// This property and are not mutually exclusive: + /// on Windows both can be at the same time. They share a single navigation + /// slot and takes precedence when rendering, so a backend + /// should check the back button first and only fall through to the drawer toggle. + /// Changes raise a handler update keyed on "DrawerToggleVisible", so a backend maps it + /// like any other toolbar property. + /// + bool DrawerToggleVisible { get; } + } } diff --git a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt index cfe5de3ccc3f..d948487ce197 100644 --- a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -363,6 +363,8 @@ virtual Microsoft.Maui.Platform.StackNavigationManager.OnCreateNavigationAnimati Microsoft.Maui.ISwipeItemMenuItemIconColor Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(Android.Views.View? containerView) -> void diff --git a/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt index a38b6347c11d..cc1a95514efd 100644 --- a/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -63,6 +63,8 @@ virtual Microsoft.Maui.Animations.PlatformTicker.Dispose(bool disposing) -> void Microsoft.Maui.ISwipeItemMenuItemIconColor Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(UIKit.UIView? containerView) -> void diff --git a/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index 65a126c1bef8..04797741c5c0 100644 --- a/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -60,6 +60,8 @@ virtual Microsoft.Maui.Animations.PlatformTicker.Dispose(bool disposing) -> void Microsoft.Maui.ISwipeItemMenuItemIconColor Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(UIKit.UIView? containerView) -> void diff --git a/src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index a6c5af2703fd..cb4cc218eba7 100644 --- a/src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -21,6 +21,8 @@ static Microsoft.Maui.GridLength.implicit operator Microsoft.Maui.GridLength(str Microsoft.Maui.ISwipeItemMenuItemIconColor Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(Tizen.NUI.BaseComponents.View? containerView) -> void diff --git a/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt index bcc66bd644e5..47c6a047f913 100644 --- a/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -48,6 +48,8 @@ virtual Microsoft.Maui.MauiWinUIApplication.OnAppInstanceActivated(Microsoft.Win Microsoft.Maui.ISwipeItemMenuItemIconColor Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(Microsoft.UI.Xaml.FrameworkElement? containerView) -> void diff --git a/src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt index d02792db092b..bd1446dd1a1e 100644 --- a/src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/net/PublicAPI.Unshipped.txt @@ -1,18 +1,22 @@ #nullable enable -Microsoft.Maui.StatusBarTheme -Microsoft.Maui.StatusBarTheme.Default = 0 -> Microsoft.Maui.StatusBarTheme -Microsoft.Maui.StatusBarTheme.Light = 1 -> Microsoft.Maui.StatusBarTheme -Microsoft.Maui.StatusBarTheme.Dark = 2 -> Microsoft.Maui.StatusBarTheme -Microsoft.Maui.IWindow.StatusBarTheme.get -> Microsoft.Maui.StatusBarTheme Microsoft.Maui.HybridWebViewInvoker Microsoft.Maui.HybridWebViewInvoker.HybridWebViewInvoker(object? invokeJavaScriptTarget, System.Type? invokeJavaScriptType) -> void Microsoft.Maui.IHybridWebView.Invoker.get -> Microsoft.Maui.HybridWebViewInvoker! Microsoft.Maui.IHybridWebView.Invoker.set -> void Microsoft.Maui.IHybridWebView.SetInvokeJavaScriptTarget(T! target, System.Text.Json.Serialization.JsonSerializerContext! jsonSerializerContext) -> void +Microsoft.Maui.ISwipeItemMenuItemIconColor +Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? Microsoft.Maui.ITab Microsoft.Maui.ITab.Icon.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.ITab.IsEnabled.get -> bool Microsoft.Maui.ITab.Title.get -> string! +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool +Microsoft.Maui.IWindow.StatusBarTheme.get -> Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme.Dark = 2 -> Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme.Default = 0 -> Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme.Light = 1 -> Microsoft.Maui.StatusBarTheme Microsoft.Maui.TabBarPlacement Microsoft.Maui.TabBarPlacement.Bottom = 1 -> Microsoft.Maui.TabBarPlacement Microsoft.Maui.TabBarPlacement.Top = 0 -> Microsoft.Maui.TabBarPlacement @@ -24,13 +28,11 @@ static Microsoft.Maui.Handlers.FlyoutViewHandler.MapFlyoutBehavior(Microsoft.Mau static Microsoft.Maui.Handlers.FlyoutViewHandler.MapFlyoutWidth(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.Handlers.FlyoutViewHandler.MapIsGestureEnabled(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.Handlers.FlyoutViewHandler.MapIsPresented(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void -static Microsoft.Maui.SafeAreaEdges.Container.get -> Microsoft.Maui.SafeAreaEdges -Microsoft.Maui.ISwipeItemMenuItemIconColor -Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? -static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void -static Microsoft.Maui.Handlers.ShapeViewHandler.MapFlowDirection(Microsoft.Maui.Handlers.IShapeViewHandler! handler, Microsoft.Maui.IShapeView! shapeView) -> void static Microsoft.Maui.Handlers.SearchBarHandler.MapCursorPosition(Microsoft.Maui.Handlers.ISearchBarHandler! handler, Microsoft.Maui.ISearchBar! searchBar) -> void static Microsoft.Maui.Handlers.SearchBarHandler.MapSelectionLength(Microsoft.Maui.Handlers.ISearchBarHandler! handler, Microsoft.Maui.ISearchBar! searchBar) -> void +static Microsoft.Maui.Handlers.ShapeViewHandler.MapFlowDirection(Microsoft.Maui.Handlers.IShapeViewHandler! handler, Microsoft.Maui.IShapeView! shapeView) -> void +static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void +static Microsoft.Maui.SafeAreaEdges.Container.get -> Microsoft.Maui.SafeAreaEdges Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(object? containerView) -> void diff --git a/src/Core/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt index a9a9b7b4cb66..1f04785c91e6 100644 --- a/src/Core/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/netstandard/PublicAPI.Unshipped.txt @@ -29,6 +29,8 @@ static Microsoft.Maui.Handlers.FlyoutViewHandler.MapFlyoutWidth(Microsoft.Maui.H static Microsoft.Maui.Handlers.FlyoutViewHandler.MapIsGestureEnabled(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.Handlers.FlyoutViewHandler.MapIsPresented(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.SafeAreaEdges.Container.get -> Microsoft.Maui.SafeAreaEdges +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.Handlers.ViewHandler.SetContainerView(object? containerView) -> void diff --git a/src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index a9a9b7b4cb66..6cbcb332f4e8 100644 --- a/src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/src/Core/src/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,26 +1,24 @@ #nullable enable -Microsoft.Maui.StatusBarTheme -Microsoft.Maui.StatusBarTheme.Default = 0 -> Microsoft.Maui.StatusBarTheme -Microsoft.Maui.StatusBarTheme.Light = 1 -> Microsoft.Maui.StatusBarTheme -Microsoft.Maui.StatusBarTheme.Dark = 2 -> Microsoft.Maui.StatusBarTheme Microsoft.Maui.HybridWebViewInvoker Microsoft.Maui.HybridWebViewInvoker.HybridWebViewInvoker(object? invokeJavaScriptTarget, System.Type? invokeJavaScriptType) -> void Microsoft.Maui.IHybridWebView.Invoker.get -> Microsoft.Maui.HybridWebViewInvoker! Microsoft.Maui.IHybridWebView.Invoker.set -> void Microsoft.Maui.IHybridWebView.SetInvokeJavaScriptTarget(T! target, System.Text.Json.Serialization.JsonSerializerContext! jsonSerializerContext) -> void +Microsoft.Maui.ISwipeItemMenuItemIconColor +Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? Microsoft.Maui.ITab Microsoft.Maui.ITab.Icon.get -> Microsoft.Maui.IImageSource? Microsoft.Maui.ITab.IsEnabled.get -> bool Microsoft.Maui.ITab.Title.get -> string! +Microsoft.Maui.IToolbarDrawerToggleVisible +Microsoft.Maui.IToolbarDrawerToggleVisible.DrawerToggleVisible.get -> bool +Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme.Dark = 2 -> Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme.Default = 0 -> Microsoft.Maui.StatusBarTheme +Microsoft.Maui.StatusBarTheme.Light = 1 -> Microsoft.Maui.StatusBarTheme Microsoft.Maui.TabBarPlacement Microsoft.Maui.TabBarPlacement.Bottom = 1 -> Microsoft.Maui.TabBarPlacement Microsoft.Maui.TabBarPlacement.Top = 0 -> Microsoft.Maui.TabBarPlacement -Microsoft.Maui.ISwipeItemMenuItemIconColor -Microsoft.Maui.ISwipeItemMenuItemIconColor.IconColor.get -> Microsoft.Maui.Graphics.Color? -static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void -static Microsoft.Maui.Handlers.ShapeViewHandler.MapFlowDirection(Microsoft.Maui.Handlers.IShapeViewHandler! handler, Microsoft.Maui.IShapeView! shapeView) -> void -static Microsoft.Maui.Handlers.SearchBarHandler.MapCursorPosition(Microsoft.Maui.Handlers.ISearchBarHandler! handler, Microsoft.Maui.ISearchBar! searchBar) -> void -static Microsoft.Maui.Handlers.SearchBarHandler.MapSelectionLength(Microsoft.Maui.Handlers.ISearchBarHandler! handler, Microsoft.Maui.ISearchBar! searchBar) -> void abstract Microsoft.Maui.HybridWebViewInvoker.InvokeMethodAsync(string! methodName, string![]? paramJsonValues) -> System.Threading.Tasks.Task! static Microsoft.Maui.Handlers.FlyoutViewHandler.MapDetail(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.Handlers.FlyoutViewHandler.MapFlyout(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void @@ -28,6 +26,10 @@ static Microsoft.Maui.Handlers.FlyoutViewHandler.MapFlyoutBehavior(Microsoft.Mau static Microsoft.Maui.Handlers.FlyoutViewHandler.MapFlyoutWidth(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.Handlers.FlyoutViewHandler.MapIsGestureEnabled(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void static Microsoft.Maui.Handlers.FlyoutViewHandler.MapIsPresented(Microsoft.Maui.Handlers.IFlyoutViewHandler! handler, Microsoft.Maui.IFlyoutView! flyoutView) -> void +static Microsoft.Maui.Handlers.SearchBarHandler.MapCursorPosition(Microsoft.Maui.Handlers.ISearchBarHandler! handler, Microsoft.Maui.ISearchBar! searchBar) -> void +static Microsoft.Maui.Handlers.SearchBarHandler.MapSelectionLength(Microsoft.Maui.Handlers.ISearchBarHandler! handler, Microsoft.Maui.ISearchBar! searchBar) -> void +static Microsoft.Maui.Handlers.ShapeViewHandler.MapFlowDirection(Microsoft.Maui.Handlers.IShapeViewHandler! handler, Microsoft.Maui.IShapeView! shapeView) -> void +static Microsoft.Maui.Handlers.SwipeItemMenuItemHandler.MapIconColor(Microsoft.Maui.Handlers.ISwipeItemMenuItemHandler! handler, Microsoft.Maui.ISwipeItemMenuItem! view) -> void static Microsoft.Maui.SafeAreaEdges.Container.get -> Microsoft.Maui.SafeAreaEdges Microsoft.Maui.IImageSourcePaint Microsoft.Maui.IImageSourcePaint.ImageSource.get -> Microsoft.Maui.IImageSource?