diff --git a/src/Controls/samples/Controls.Sample/Pages/Core/ToolbarBadgePage.cs b/src/Controls/samples/Controls.Sample/Pages/Core/ToolbarBadgePage.cs deleted file mode 100644 index 32557e306104..000000000000 --- a/src/Controls/samples/Controls.Sample/Pages/Core/ToolbarBadgePage.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using Microsoft.Maui; -using Microsoft.Maui.Controls; -using Microsoft.Maui.Graphics; -using Maui.Controls.Sample.Pages.Base; - -namespace Maui.Controls.Sample.Pages; - -public class ToolbarBadgePage : BasePage -{ - readonly ToolbarItem _numericItem; - readonly ToolbarItem _textItem; - readonly ToolbarItem _colorItem; - readonly Label _statusLabel; - int _count; - - public ToolbarBadgePage() - { - // Remove default Settings toolbar item from BasePage and re-add with badge - ToolbarItems.Clear(); - - _statusLabel = new Label - { - Text = "Toolbar items above have badges. Use buttons to interact.", - FontSize = 16, - Margin = new Thickness(0, 0, 0, 20) - }; - - _numericItem = new ToolbarItem - { - Text = "Alerts", - IconImageSource = new FontImageSource - { - FontFamily = "Ionicons", - Glyph = "\uf2e3", - Color = Colors.Black - }, - BadgeText = "3" - }; - _numericItem.Clicked += (s, e) => _statusLabel.Text = "Tapped: Alerts"; - - _textItem = new ToolbarItem - { - Text = "Messages", - IconImageSource = new FontImageSource - { - FontFamily = "Ionicons", - Glyph = "\uf30c", - Color = Colors.Black - }, - BadgeText = "New" - }; - _textItem.Clicked += (s, e) => _statusLabel.Text = "Tapped: Messages"; - - _colorItem = new ToolbarItem - { - Text = "Cart", - IconImageSource = new FontImageSource - { - FontFamily = "Ionicons", - Glyph = "\uf30d", - Color = Colors.Black - }, - BadgeText = "2", - BadgeColor = Colors.Green - }; - _colorItem.Clicked += (s, e) => _statusLabel.Text = "Tapped: Cart"; - - ToolbarItems.Add(_numericItem); - ToolbarItems.Add(_textItem); - ToolbarItems.Add(_colorItem); - - _count = 3; - - Content = new ScrollView - { - Content = new VerticalStackLayout - { - Spacing = 12, - Padding = 20, - Children = - { - _statusLabel, - CreateSection("Badge Count", - new Button { Text = "Increment Count", Command = new Command(IncrementCount) }, - new Button { Text = "Decrement Count", Command = new Command(DecrementCount) }, - new Button { Text = "Set Large Count (99+)", Command = new Command(() => SetBadgeText(_numericItem, "99+")) } - ), - CreateSection("Badge Text", - new Button { Text = "Set 'New'", Command = new Command(() => SetBadgeText(_textItem, "New")) }, - new Button { Text = "Set '!'", Command = new Command(() => SetBadgeText(_textItem, "!")) }, - new Button { Text = "Set Empty (dot badge)", Command = new Command(() => SetBadgeText(_textItem, "")) } - ), - CreateSection("Badge Color", - new Button { Text = "Red", Command = new Command(() => SetBadgeColor(Colors.Red)) }, - new Button { Text = "Blue", Command = new Command(() => SetBadgeColor(Colors.Blue)) }, - new Button { Text = "Green", Command = new Command(() => SetBadgeColor(Colors.Green)) }, - new Button { Text = "Platform Default (null)", Command = new Command(() => SetBadgeColor(null)) } - ), - CreateSection("Badge Text Color", - new Button { Text = "White Text", Command = new Command(() => SetBadgeTextColor(Colors.White)) }, - new Button { Text = "Black Text", Command = new Command(() => SetBadgeTextColor(Colors.Black)) }, - new Button { Text = "Yellow Text", Command = new Command(() => SetBadgeTextColor(Colors.Yellow)) }, - new Button { Text = "Platform Default (null)", Command = new Command(() => SetBadgeTextColor(null)) } - ), - CreateSection("Visibility", - new Button { Text = "Clear All Badges", Command = new Command(ClearAll) }, - new Button { Text = "Restore All Badges", Command = new Command(RestoreAll) } - ), - new Label - { - Text = "Platform Notes:\n" + - "• Android: Full support via Material BadgeDrawable\n" + - "• iOS/macOS: Requires iOS 26+ / macOS 26+\n" + - "• Windows: Non-numeric text shows as dot indicator", - FontSize = 12, - TextColor = Colors.Gray, - Margin = new Thickness(0, 20, 0, 0) - } - } - } - }; - } - - static Border CreateSection(string title, params View[] children) - { - var stack = new VerticalStackLayout { Spacing = 8 }; - stack.Children.Add(new Label { Text = title, FontAttributes = FontAttributes.Bold, FontSize = 14 }); - foreach (var child in children) - stack.Children.Add(child); - - return new Border - { - Content = stack, - Padding = 12, - Margin = new Thickness(0, 4), - StrokeShape = new Microsoft.Maui.Controls.Shapes.RoundRectangle { CornerRadius = 8 }, - Stroke = Colors.LightGray - }; - } - - void IncrementCount() - { - _count++; - _numericItem.BadgeText = _count.ToString(); - _statusLabel.Text = $"Count: {_count}"; - } - - void DecrementCount() - { - _count = Math.Max(0, _count - 1); - _numericItem.BadgeText = _count > 0 ? _count.ToString() : null; - _statusLabel.Text = _count > 0 ? $"Count: {_count}" : "Count badge cleared (0)"; - } - - void SetBadgeText(ToolbarItem item, string text) - { - item.BadgeText = text; - _statusLabel.Text = string.IsNullOrEmpty(text) ? "Badge text: (empty/dot)" : $"Badge text: '{text}'"; - } - - void SetBadgeColor(Color? color) - { - _colorItem.BadgeColor = color; - _statusLabel.Text = color is null ? "Badge color: platform default" : $"Badge color: {color}"; - } - - void SetBadgeTextColor(Color? color) - { - // Apply text color to all toolbar items to demonstrate the effect - _numericItem.BadgeTextColor = color; - _textItem.BadgeTextColor = color; - _colorItem.BadgeTextColor = color; - _statusLabel.Text = color is null ? "Badge text color: platform default" : $"Badge text color: {color}"; - } - - void ClearAll() - { - _numericItem.BadgeText = null; - _textItem.BadgeText = null; - _colorItem.BadgeText = null; - _count = 0; - _statusLabel.Text = "All badges cleared"; - } - - void RestoreAll() - { - _count = 3; - _numericItem.BadgeText = "3"; - _textItem.BadgeText = "New"; - _colorItem.BadgeText = "2"; - _colorItem.BadgeColor = Colors.Green; - _statusLabel.Text = "Badges restored"; - } -} diff --git a/src/Controls/samples/Controls.Sample/ViewModels/CoreViewModel.cs b/src/Controls/samples/Controls.Sample/ViewModels/CoreViewModel.cs index 70b53214d97f..c17ea3f28985 100644 --- a/src/Controls/samples/Controls.Sample/ViewModels/CoreViewModel.cs +++ b/src/Controls/samples/Controls.Sample/ViewModels/CoreViewModel.cs @@ -72,9 +72,6 @@ protected override IEnumerable CreateItems() => new[] new SectionModel(typeof(ToolbarPage), "Toolbar", "Toolbar items are buttons that are typically displayed in the navigation bar."), - new SectionModel(typeof(ToolbarBadgePage), "Toolbar Badges", - "Badge notifications on toolbar items using BadgeText and BadgeColor properties."), - new SectionModel(typeof(TransformationsPage), "Transformations", "Apply scale transformations, rotation, etc. to a View."), diff --git a/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs b/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs index c5279f1ce561..2ad07699ed1c 100644 --- a/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs +++ b/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs @@ -105,7 +105,6 @@ public PrimaryToolbarItem(ToolbarItem item, bool forceName) Clicked += OnClicked; item.PropertyChanged += OnPropertyChanged; - UpdateBadge(item); if (item != null && !string.IsNullOrEmpty(item.AutomationId)) AccessibilityIdentifier = item.AutomationId; @@ -153,8 +152,6 @@ void OnPropertyChanged(object sender, PropertyChangedEventArgs e) UpdateTextAndStyle(item); } } - else if (e.PropertyName == nameof(ToolbarItem.BadgeText) || e.PropertyName == nameof(ToolbarItem.BadgeColor) || e.PropertyName == nameof(ToolbarItem.BadgeTextColor)) - UpdateBadge(item); #pragma warning disable CS0618 // Type or member is obsolete else if (e.PropertyName == AutomationProperties.HelpTextProperty.PropertyName) this.SetAccessibilityHint(item); @@ -198,41 +195,6 @@ void UpdateTextAndStyle(ToolbarItem item) #pragma warning restore CA1416, CA1422 Image = null; } - - void UpdateBadge(ToolbarItem item) - { - // UIBarButtonItem.Badge is only available on iOS 26+ / MacCatalyst 26+ - if (!OperatingSystem.IsIOSVersionAtLeast(26) && !OperatingSystem.IsMacCatalystVersionAtLeast(26)) - return; - - var badgeText = item.BadgeText; - - if (badgeText is null) - { -#pragma warning disable CA1416 // Validate platform compatibility - this.Badge = null; -#pragma warning restore CA1416 - return; - } - -#pragma warning disable CA1416 // Validate platform compatibility - UIBarButtonItemBadge badge; - if (badgeText.Length == 0) - badge = UIBarButtonItemBadge.Create(0); // Empty string shows as dot indicator - else if (int.TryParse(badgeText, out var count) && count >= 0) - badge = UIBarButtonItemBadge.Create((nuint)count); - else - badge = UIBarButtonItemBadge.Create(badgeText); - - if (item.BadgeColor is not null) - badge.BackgroundColor = item.BadgeColor.ToPlatform(); - - if (item.BadgeTextColor is not null) - badge.ForegroundColor = item.BadgeTextColor.ToPlatform(); - - this.Badge = badge; -#pragma warning restore CA1416 - } } internal sealed class SecondarySubToolbarItem diff --git a/src/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cs b/src/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cs index 4d17407cad2d..142eefab1b40 100644 --- a/src/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cs +++ b/src/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cs @@ -2,7 +2,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using Android.Content; using Android.Content.Res; using Android.Graphics; @@ -14,7 +13,6 @@ using AndroidX.AppCompat.Widget; using AndroidX.Core.View; using AndroidX.Core.View.Accessibility; -using Google.Android.Material.Badge; using Microsoft.Maui.Graphics; using Microsoft.Maui.Primitives; using AGraphics = Android.Graphics; @@ -29,14 +27,11 @@ internal static class ToolbarExtensions { static ColorStateList? _defaultTitleTextColor; static int? _defaultNavigationIconColor; - + // Track which ToolbarItem should currently be associated with each MenuItem ID to prevent race conditions // This prevents stale async icon loading callbacks from updating the wrong toolbar items during navigation static readonly ConcurrentDictionary> _menuItemToolbarItemMap = new(); - // Track badge drawables per menu item ID for lifecycle management - static readonly ConcurrentDictionary _badgeDrawables = new(); - public static void UpdateIsVisible(this AToolbar nativeToolbar, Toolbar toolbar) { _ = nativeToolbar.Context ?? throw new ArgumentNullException(nameof(nativeToolbar.Context)); @@ -252,119 +247,6 @@ public static void DisposeMenuItems(this AToolbar? toolbar, IEnumerable - { - if (!toolbar.IsAttachedToWindow) - return; - - // Race condition guard: if badge text changed since we posted, - // skip this update — a newer callback will handle it - if (toolbarItem.BadgeText != expectedBadgeText) - return; - - // Guard against recycled menu items: verify this menuItemId still - // maps to the same ToolbarItem we intended to update - if (_menuItemToolbarItemMap.TryGetValue(menuItemId, out var weakRef) && - weakRef.TryGetTarget(out var currentToolbarItem) && - !ReferenceEquals(currentToolbarItem, toolbarItem)) - return; - - var anchorView = toolbar.FindViewById(menuItemId); - if (anchorView == null) - return; - - // Remove existing badge first - CleanupBadgeDrawable(toolbar, menuItemId); - - var badge = BadgeDrawable.Create(context); - if (badgeText.Length > 0) - badge.Text = badgeText; - else - badge.ClearNumber(); // Empty string shows as dot indicator - - var badgeColor = toolbarItem.BadgeColor; - if (badgeColor is not null) - badge.BackgroundColor = badgeColor.ToPlatform(); - - var badgeTextColor = toolbarItem.BadgeTextColor; - if (badgeTextColor is not null) - badge.BadgeTextColor = badgeTextColor.ToPlatform(); - - try - { - BadgeUtils.AttachBadgeDrawable(badge, anchorView, null); - } - catch (Java.Lang.Exception) - { - // BadgeUtils may fail if the view is not properly attached; - // fall back to direct overlay attachment - badge.UpdateBadgeCoordinates(anchorView, null); - anchorView.Overlay?.Add(badge); - } - - _badgeDrawables[menuItemId] = badge; - }); - } - - static void CleanupBadgeDrawable(AToolbar toolbar, int menuItemId) - { - if (_badgeDrawables.TryRemove(menuItemId, out var existingBadge)) - { - var anchorView = toolbar.FindViewById(menuItemId); - if (anchorView != null) - { - try - { - BadgeUtils.DetachBadgeDrawable(existingBadge, anchorView); - } - catch (Java.Lang.Exception) - { - anchorView.Overlay?.Remove(existingBadge); - } - } - existingBadge.Dispose(); - } - } - - static void CleanupBadgeDrawable(int menuItemId) - { - if (_badgeDrawables.TryRemove(menuItemId, out var existingBadge)) - existingBadge.Dispose(); } public static void UpdateMenuItems(this AToolbar toolbar, @@ -391,8 +273,7 @@ public static void UpdateMenuItems(this AToolbar toolbar, { // Clean up the mapping for disposed MenuItems _menuItemToolbarItemMap.TryRemove(previousMenuItem.ItemId, out _); - CleanupBadgeDrawable(previousMenuItem.ItemId); - + previousMenuItem.Dispose(); previousMenuItems.RemoveAt(j); } @@ -414,11 +295,10 @@ public static void UpdateMenuItems(this AToolbar toolbar, { var menuItemToRemove = previousMenuItems[toolBarItemCount]; menu?.RemoveItem(menuItemToRemove.ItemId); - + // Clean up the mapping for disposed MenuItems _menuItemToolbarItemMap.TryRemove(menuItemToRemove.ItemId, out _); - CleanupBadgeDrawable(menuItemToRemove.ItemId); - + menuItemToRemove.Dispose(); previousMenuItems.RemoveAt(toolBarItemCount); } @@ -494,7 +374,7 @@ static void UpdateMenuItem(AToolbar toolbar, // Track which ToolbarItem should be associated with this MenuItem to prevent race conditions _menuItemToolbarItemMap[menuitem.ItemId] = new WeakReference(item); - + // NOTE: Custom updateMenuItemIcon callbacks are responsible for their own // race condition handling. The _menuItemToolbarItemMap guard only applies // to the default UpdateMenuItemIcon path. @@ -523,9 +403,6 @@ static void UpdateMenuItem(AToolbar toolbar, } SetSemanticProperties(item, toolbar.FindViewById(menuitem.ItemId)); - - if (item.Order != ToolbarItemOrder.Secondary && !string.IsNullOrEmpty(item.BadgeText)) - UpdateToolbarItemBadge(toolbar, menuitem, item); } static void SetSemanticProperties(ToolbarItem menuItem, AView? view) @@ -632,22 +509,6 @@ public static void OnToolbarItemPropertyChanged( if (toolbarItems == null) return; - // Handle badge property changes without rebuilding the menu item - if (e.PropertyName == nameof(ToolbarItem.BadgeText) || e.PropertyName == nameof(ToolbarItem.BadgeColor) || e.PropertyName == nameof(ToolbarItem.BadgeTextColor)) - { - int badgeIndex = 0; - foreach (var ti in toolbarItems) - { - if (ti == toolbarItem) - break; - badgeIndex++; - } - - if (badgeIndex < currentMenuItems.Count && currentMenuItems[badgeIndex].IsAlive()) - UpdateToolbarItemBadge(toolbar, currentMenuItems[badgeIndex], toolbarItem); - return; - } - if (!e.IsOneOf(MenuItem.TextProperty, MenuItem.IconImageSourceProperty, MenuItem.IsEnabledProperty)) return; var context = mauiContext.Context; 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 84cee805f28e..a59be8806413 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -47,17 +47,15 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~const Microsoft.Maui.Controls.AppThemeBinding.AppThemeResource = "__MAUI_ApplicationTheme__" -> string ~override Microsoft.Maui.Controls.Handlers.Items.MauiRecyclerView.OnInterceptTouchEvent(Android.Views.MotionEvent e) -> bool ~override Microsoft.Maui.Controls.Handlers.Items.MauiRecyclerView.OnTouchEvent(Android.Views.MotionEvent e) -> bool @@ -66,13 +64,6 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~virtual Microsoft.Maui.Controls.Platform.Compatibility.ShellItemRenderer.UpdateShellSectionBadge(Microsoft.Maui.Controls.ShellSection shellSection, int index) -> void -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty +~virtual Microsoft.Maui.Controls.Platform.Compatibility.ShellItemRenderer.UpdateShellSectionBadge(Microsoft.Maui.Controls.ShellSection shellSection, int index) -> void diff --git a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt index 6530c756dfd7..ed4747c31bc2 100644 --- a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -49,17 +49,15 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~const Microsoft.Maui.Controls.AppThemeBinding.AppThemeResource = "__MAUI_ApplicationTheme__" -> string ~override Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutRenderer.ViewWillTransitionToSize(CoreGraphics.CGSize toSize, UIKit.IUIViewControllerTransitionCoordinator coordinator) -> void ~static Microsoft.Maui.Controls.VisualStateManager.GetVisualStateGroups(Microsoft.Maui.Controls.VisualElement visualElement) -> Microsoft.Maui.Controls.VisualStateGroupList @@ -67,12 +65,5 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty diff --git a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index 6530c756dfd7..ed4747c31bc2 100644 --- a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -49,17 +49,15 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~const Microsoft.Maui.Controls.AppThemeBinding.AppThemeResource = "__MAUI_ApplicationTheme__" -> string ~override Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutRenderer.ViewWillTransitionToSize(CoreGraphics.CGSize toSize, UIKit.IUIViewControllerTransitionCoordinator coordinator) -> void ~static Microsoft.Maui.Controls.VisualStateManager.GetVisualStateGroups(Microsoft.Maui.Controls.VisualElement visualElement) -> Microsoft.Maui.Controls.VisualStateGroupList @@ -67,12 +65,5 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty 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 0675c61a1834..7fbb11940dcc 100644 --- a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -51,29 +51,20 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~const Microsoft.Maui.Controls.AppThemeBinding.AppThemeResource = "__MAUI_ApplicationTheme__" -> string ~static Microsoft.Maui.Controls.VisualStateManager.GetVisualStateGroups(Microsoft.Maui.Controls.VisualElement visualElement) -> Microsoft.Maui.Controls.VisualStateGroupList ~static Microsoft.Maui.Controls.VisualStateManager.InvalidateVisualStates(Microsoft.Maui.Controls.VisualElement visualElement) -> void ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty diff --git a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt index e1dd7c9aa15c..790a1b7a0234 100644 --- a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -47,29 +47,20 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~const Microsoft.Maui.Controls.AppThemeBinding.AppThemeResource = "__MAUI_ApplicationTheme__" -> string ~static Microsoft.Maui.Controls.VisualStateManager.GetVisualStateGroups(Microsoft.Maui.Controls.VisualElement visualElement) -> Microsoft.Maui.Controls.VisualStateGroupList ~static Microsoft.Maui.Controls.VisualStateManager.InvalidateVisualStates(Microsoft.Maui.Controls.VisualElement visualElement) -> void ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty diff --git a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt index e1dd7c9aa15c..790a1b7a0234 100644 --- a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt @@ -47,29 +47,20 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~const Microsoft.Maui.Controls.AppThemeBinding.AppThemeResource = "__MAUI_ApplicationTheme__" -> string ~static Microsoft.Maui.Controls.VisualStateManager.GetVisualStateGroups(Microsoft.Maui.Controls.VisualElement visualElement) -> Microsoft.Maui.Controls.VisualStateGroupList ~static Microsoft.Maui.Controls.VisualStateManager.InvalidateVisualStates(Microsoft.Maui.Controls.VisualElement visualElement) -> void ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty diff --git a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt index 79f892331247..6217b08db112 100644 --- a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt @@ -39,28 +39,19 @@ virtual Microsoft.Maui.Controls.LongPressingEventArgs.GetPosition(Microsoft.Maui ~Microsoft.Maui.Controls.BaseShellItem.BadgeText.set -> void ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color ~Microsoft.Maui.Controls.BaseShellItem.BadgeTextColor.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand +~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object +~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.Keys.get -> System.Collections.Generic.IEnumerable ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResolveValue(string key) -> object ~Microsoft.Maui.Controls.Internals.ResourcesChangedEventArgs.ResourcesChangedEventArgs(System.Collections.Generic.IEnumerable keys, System.Func resolver) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(System.Type targetType, System.Func factory, bool shared = true) -> void ~Microsoft.Maui.Controls.ResourceDictionary.AddFactory(string key, System.Func factory, bool shared = true) -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeColor.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.get -> string -~Microsoft.Maui.Controls.ToolbarItem.BadgeText.set -> void -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.get -> Microsoft.Maui.Graphics.Color -~Microsoft.Maui.Controls.ToolbarItem.BadgeTextColor.set -> void ~static Microsoft.Maui.Controls.VisualStateManager.GetVisualStateGroups(Microsoft.Maui.Controls.VisualElement visualElement) -> Microsoft.Maui.Controls.VisualStateGroupList ~static Microsoft.Maui.Controls.VisualStateManager.InvalidateVisualStates(Microsoft.Maui.Controls.VisualElement visualElement) -> void ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.BaseShellItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextColorProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.ToolbarItem.BadgeTextProperty -> Microsoft.Maui.Controls.BindableProperty -~Microsoft.Maui.Controls.Editor.ReturnCommand.get -> System.Windows.Input.ICommand -~Microsoft.Maui.Controls.Editor.ReturnCommand.set -> void -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.get -> object -~Microsoft.Maui.Controls.Editor.ReturnCommandParameter.set -> void ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandParameterProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Editor.ReturnCommandProperty -> Microsoft.Maui.Controls.BindableProperty diff --git a/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs b/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs index 1e6d3649d283..079ab85582d8 100644 --- a/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs +++ b/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs @@ -1,12 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using Microsoft.Maui.Controls.Platform; using Microsoft.Maui.Graphics; -using Microsoft.Maui.Platform; using Microsoft.UI.Xaml.Controls; using NativeAutomationProperties = Microsoft.UI.Xaml.Automation.AutomationProperties; -using WGrid = Microsoft.UI.Xaml.Controls.Grid; using WImage = Microsoft.UI.Xaml.Controls.Image; namespace Microsoft.Maui.Controls @@ -58,52 +56,7 @@ internal void UpdateMenu() var img = new WImage(); img.SetBinding(WImage.SourceProperty, "Value"); img.SetBinding(WImage.DataContextProperty, "IconImageSource", _imageConverter); - - if (item.BadgeText is not null) - { - // Wrap icon in a Grid with InfoBadge overlay for badge support - var grid = new WGrid(); -#pragma warning disable RS0030 // Standalone WinUI Grid, not a MauiPanel - grid.Children.Add(img); - - var infoBadge = new InfoBadge - { - HorizontalAlignment = Microsoft.UI.Xaml.HorizontalAlignment.Right, - VerticalAlignment = Microsoft.UI.Xaml.VerticalAlignment.Top, - Margin = new Microsoft.UI.Xaml.Thickness(0, -4, -4, 0), - }; - UpdateInfoBadge(infoBadge, item); - grid.Children.Add(infoBadge); -#pragma warning restore RS0030 - - button.Content = grid; - } - else - { - button.Content = img; - } - } - - // For text-only toolbar items (no icon), wrap the label in a Grid - // with InfoBadge overlay so badges are still visible. - if (item.IconImageSource.IsNullOrEmpty() && item.BadgeText is not null) - { - var textBlock = new Microsoft.UI.Xaml.Controls.TextBlock { Text = item.Text ?? string.Empty }; - var grid = new WGrid(); -#pragma warning disable RS0030 // Standalone WinUI Grid, not a MauiPanel - grid.Children.Add(textBlock); - - var infoBadge = new InfoBadge - { - HorizontalAlignment = Microsoft.UI.Xaml.HorizontalAlignment.Right, - VerticalAlignment = Microsoft.UI.Xaml.VerticalAlignment.Top, - Margin = new Microsoft.UI.Xaml.Thickness(0, -4, -4, 0), - }; - UpdateInfoBadge(infoBadge, item); - grid.Children.Add(infoBadge); -#pragma warning restore RS0030 - - button.Content = grid; + button.Content = img; } button.Command = new MenuItemCommand(item); @@ -143,66 +96,6 @@ internal void OnToolbarItemPropertyChanged(object? sender, PropertyChangedEventA return; } - if (e.PropertyName == nameof(ToolbarItem.BadgeText) || e.PropertyName == nameof(ToolbarItem.BadgeColor) || e.PropertyName == nameof(ToolbarItem.BadgeTextColor)) - { - if (sender is ToolbarItem toolbarItem) - { - foreach (var command in commandBar.PrimaryCommands) - { - if (command is AppBarButton button && ReferenceEquals(button.DataContext, toolbarItem)) - { - if (button.Content is WGrid grid) - { -#pragma warning disable RS0030 // Standalone WinUI Grid, not a MauiPanel - foreach (var child in grid.Children) -#pragma warning restore RS0030 - { - if (child is InfoBadge badge) - { - UpdateInfoBadge(badge, toolbarItem); - break; - } - } - } - else if (toolbarItem.BadgeText is not null) - { - // Item didn't have a badge before - wrap content in Grid with InfoBadge - var existingContent = button.Content as Microsoft.UI.Xaml.UIElement; - if (existingContent == null && !toolbarItem.IconImageSource.IsNullOrEmpty()) - { - var img = new WImage(); - img.SetBinding(WImage.SourceProperty, "Value"); - img.SetBinding(WImage.DataContextProperty, "IconImageSource", _imageConverter); - existingContent = img; - } - else if (existingContent == null) - { - existingContent = new Microsoft.UI.Xaml.Controls.TextBlock { Text = toolbarItem.Text ?? string.Empty }; - } - - var newGrid = new WGrid(); -#pragma warning disable RS0030 // Standalone WinUI Grid, not a MauiPanel - newGrid.Children.Add(existingContent); - - var newBadge = new InfoBadge - { - HorizontalAlignment = Microsoft.UI.Xaml.HorizontalAlignment.Right, - VerticalAlignment = Microsoft.UI.Xaml.VerticalAlignment.Top, - Margin = new Microsoft.UI.Xaml.Thickness(0, -4, -4, 0), - }; - UpdateInfoBadge(newBadge, toolbarItem); - newGrid.Children.Add(newBadge); -#pragma warning restore RS0030 - - button.Content = newGrid; - } - break; - } - } - } - return; - } - if (e.PropertyName == nameof(ToolbarItem.Text) || e.PropertyName == nameof(ToolbarItem.IconImageSource)) { var toolbarItems = new List(ToolbarItems ?? Array.Empty()); @@ -210,47 +103,6 @@ internal void OnToolbarItemPropertyChanged(object? sender, PropertyChangedEventA } } - /// - /// Updates an InfoBadge control to reflect the current badge state of a ToolbarItem. - /// On Windows, numeric badge text displays as a count; non-numeric text and empty string display as a dot indicator. - /// Setting BadgeText to null hides the badge; setting to empty string shows a dot. - /// - static void UpdateInfoBadge(InfoBadge badge, ToolbarItem item) - { - var badgeText = item.BadgeText; - - if (badgeText is null) - { - badge.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed; - return; - } - - badge.Visibility = Microsoft.UI.Xaml.Visibility.Visible; - - if (badgeText.Length == 0) - badge.Value = -1; // Empty string shows as dot indicator - else if (int.TryParse(badgeText, out var value) && value >= 0) - badge.Value = value; - else - badge.Value = -1; // Non-numeric text also shows as dot indicator - - if (item.BadgeColor is not null) - { - badge.Background = new Microsoft.UI.Xaml.Media.SolidColorBrush( - item.BadgeColor.ToWindowsColor()); - } - else - badge.ClearValue(InfoBadge.BackgroundProperty); - - if (item.BadgeTextColor is not null) - { - badge.Foreground = new Microsoft.UI.Xaml.Media.SolidColorBrush( - item.BadgeTextColor.ToWindowsColor()); - } - else - badge.ClearValue(InfoBadge.ForegroundProperty); - } - private static void SetDefaultLabelPosition(CommandBar commandBar, IList toolbarItems) { int itemsWithTextCount = 0; diff --git a/src/Controls/src/Core/Toolbar/ToolbarItem.cs b/src/Controls/src/Core/Toolbar/ToolbarItem.cs index 7d87daa194e2..1bef15f97afe 100644 --- a/src/Controls/src/Core/Toolbar/ToolbarItem.cs +++ b/src/Controls/src/Core/Toolbar/ToolbarItem.cs @@ -1,6 +1,5 @@ #nullable disable using System; -using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls; @@ -18,18 +17,6 @@ public class ToolbarItem : MenuItem static readonly BindableProperty PriorityProperty = BindableProperty.Create(nameof(Priority), typeof(int), typeof(ToolbarItem), 0); - /// Bindable property for . - public static readonly BindableProperty BadgeTextProperty = BindableProperty.Create( - nameof(BadgeText), typeof(string), typeof(ToolbarItem), default(string)); - - /// Bindable property for . - public static readonly BindableProperty BadgeColorProperty = BindableProperty.Create( - nameof(BadgeColor), typeof(Color), typeof(ToolbarItem), default(Color)); - - /// Bindable property for . - public static readonly BindableProperty BadgeTextColorProperty = BindableProperty.Create( - nameof(BadgeTextColor), typeof(Color), typeof(ToolbarItem), default(Color)); - /// /// Constructs and initializes a new instance of the ToolbarItem class. /// @@ -78,64 +65,4 @@ public int Priority get { return (int)GetValue(PriorityProperty); } set { SetValue(PriorityProperty, value); } } - - /// - /// Gets or sets the badge text displayed on this toolbar item. - /// Set to a non-empty string to show a text/count badge, an empty string to show a dot indicator, or to hide the badge. - /// This is a bindable property. - /// - /// - /// - /// Badge rendering varies by platform: - /// - /// - /// Android: Uses Material Design BadgeDrawable via BadgeUtils. Supports numeric and text badges on primary toolbar items. Empty string shows a small dot indicator. - /// iOS/MacCatalyst: Uses the native UIBarButtonItem.badge API introduced in iOS 26. On earlier iOS versions, the badge is silently ignored. Empty string shows a dot indicator. - /// Windows: Uses WinUI InfoBadge overlaid on the toolbar button. Numeric values display as counts; non-numeric text and empty string display as a dot indicator. - /// - /// - /// Badges are only displayed on primary toolbar items (items with set to or ). - /// Secondary (overflow) items do not display badges. - /// - /// - public string BadgeText - { - get => (string)GetValue(BadgeTextProperty); - set => SetValue(BadgeTextProperty, value); - } - - /// - /// Gets or sets the background color of the badge displayed on this toolbar item. - /// When set to , the platform default badge color is used. - /// This is a bindable property. - /// - /// - /// This property is only effective when is set to a non-empty value. - /// - public Color BadgeColor - { - get => (Color)GetValue(BadgeColorProperty); - set => SetValue(BadgeColorProperty, value); - } - - /// - /// Gets or sets the foreground (text) color of the badge displayed on this toolbar item. - /// When set to , the platform default text color is used (typically white). - /// This is a bindable property. - /// - /// - /// - /// Platform support: - /// - /// - /// Android: Maps to BadgeDrawable.BadgeTextColor. - /// iOS/MacCatalyst 26+: Maps to UIBarButtonItemBadge.ForegroundColor. - /// Windows: Maps to InfoBadge.Foreground. - /// - /// - public Color BadgeTextColor - { - get => (Color)GetValue(BadgeTextColorProperty); - set => SetValue(BadgeTextColorProperty, value); - } } diff --git a/src/Controls/tests/Core.UnitTests/ToolbarItemBadgeTests.cs b/src/Controls/tests/Core.UnitTests/ToolbarItemBadgeTests.cs deleted file mode 100644 index 9716ffc8bc60..000000000000 --- a/src/Controls/tests/Core.UnitTests/ToolbarItemBadgeTests.cs +++ /dev/null @@ -1,285 +0,0 @@ -using Microsoft.Maui.Graphics; -using Xunit; - -namespace Microsoft.Maui.Controls.Core.UnitTests -{ - public class ToolbarItemBadgeTests : BaseTestFixture - { - [Fact] - public void BadgeTextDefaultIsNull() - { - var item = new ToolbarItem(); - Assert.Null(item.BadgeText); - } - - [Fact] - public void BadgeColorDefaultIsNull() - { - var item = new ToolbarItem(); - Assert.Null(item.BadgeColor); - } - - [Fact] - public void SetBadgeTextNumeric() - { - var item = new ToolbarItem(); - item.BadgeText = "5"; - Assert.Equal("5", item.BadgeText); - } - - [Fact] - public void SetBadgeTextArbitraryString() - { - var item = new ToolbarItem(); - item.BadgeText = "New"; - Assert.Equal("New", item.BadgeText); - } - - [Fact] - public void ClearBadgeText() - { - var item = new ToolbarItem(); - item.BadgeText = "3"; - item.BadgeText = null; - Assert.Null(item.BadgeText); - } - - [Fact] - public void SetBadgeColor() - { - var item = new ToolbarItem(); - item.BadgeColor = Colors.Red; - Assert.Equal(Colors.Red, item.BadgeColor); - } - - [Fact] - public void ClearBadgeColor() - { - var item = new ToolbarItem(); - item.BadgeColor = Colors.Blue; - item.BadgeColor = null; - Assert.Null(item.BadgeColor); - } - - [Fact] - public void BadgeTextPropertyChangedFires() - { - var item = new ToolbarItem(); - bool fired = false; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeText)) - fired = true; - }; - item.BadgeText = "1"; - Assert.True(fired); - } - - [Fact] - public void BadgeColorPropertyChangedFires() - { - var item = new ToolbarItem(); - bool fired = false; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeColor)) - fired = true; - }; - item.BadgeColor = Colors.Green; - Assert.True(fired); - } - - [Fact] - public void BadgeTextDoesNotFireWhenSameValue() - { - var item = new ToolbarItem { BadgeText = "5" }; - int fireCount = 0; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeText)) - fireCount++; - }; - item.BadgeText = "5"; - Assert.Equal(0, fireCount); - } - - [Fact] - public void BadgeColorDoesNotFireWhenSameValue() - { - var item = new ToolbarItem { BadgeColor = Colors.Red }; - int fireCount = 0; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeColor)) - fireCount++; - }; - item.BadgeColor = Colors.Red; - Assert.Equal(0, fireCount); - } - - [Fact] - public void BadgeTextBindableProperty() - { - var item = new ToolbarItem(); - item.SetValue(ToolbarItem.BadgeTextProperty, "99+"); - Assert.Equal("99+", item.BadgeText); - } - - [Fact] - public void BadgeColorBindableProperty() - { - var item = new ToolbarItem(); - item.SetValue(ToolbarItem.BadgeColorProperty, Colors.Orange); - Assert.Equal(Colors.Orange, item.BadgeColor); - } - - [Fact] - public void BadgeTextDataBinding() - { - var vm = new { Count = "42" }; - var item = new ToolbarItem(); - item.BindingContext = vm; - item.SetBinding(ToolbarItem.BadgeTextProperty, "Count"); - Assert.Equal("42", item.BadgeText); - } - - [Fact] - public void BadgeColorDataBinding() - { - var vm = new { Highlight = Colors.Purple }; - var item = new ToolbarItem(); - item.BindingContext = vm; - item.SetBinding(ToolbarItem.BadgeColorProperty, "Highlight"); - Assert.Equal(Colors.Purple, item.BadgeColor); - } - - [Fact] - public void BadgeTextEmptyStringTreatedAsValue() - { - var item = new ToolbarItem(); - item.BadgeText = ""; - Assert.Equal("", item.BadgeText); - } - - [Fact] - public void BadgePropertiesIndependent() - { - var item = new ToolbarItem(); - item.BadgeText = "3"; - item.BadgeColor = Colors.Red; - - // Clearing text should not affect color - item.BadgeText = null; - Assert.Null(item.BadgeText); - Assert.Equal(Colors.Red, item.BadgeColor); - - // Clearing color should not affect text - item.BadgeText = "5"; - item.BadgeColor = null; - Assert.Equal("5", item.BadgeText); - Assert.Null(item.BadgeColor); - } - - [Fact] - public void BadgeTextColorDefaultIsNull() - { - var item = new ToolbarItem(); - Assert.Null(item.BadgeTextColor); - } - - [Fact] - public void SetBadgeTextColor() - { - var item = new ToolbarItem(); - item.BadgeTextColor = Colors.White; - Assert.Equal(Colors.White, item.BadgeTextColor); - } - - [Fact] - public void ClearBadgeTextColor() - { - var item = new ToolbarItem(); - item.BadgeTextColor = Colors.Black; - item.BadgeTextColor = null; - Assert.Null(item.BadgeTextColor); - } - - [Fact] - public void BadgeTextColorPropertyChangedFires() - { - var item = new ToolbarItem(); - bool fired = false; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeTextColor)) - fired = true; - }; - item.BadgeTextColor = Colors.Yellow; - Assert.True(fired); - } - - [Fact] - public void BadgeTextColorDoesNotFireWhenSameValue() - { - var item = new ToolbarItem { BadgeTextColor = Colors.White }; - int fireCount = 0; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeTextColor)) - fireCount++; - }; - item.BadgeTextColor = Colors.White; - Assert.Equal(0, fireCount); - } - - [Fact] - public void BadgeTextColorBindableProperty() - { - var item = new ToolbarItem(); - item.SetValue(ToolbarItem.BadgeTextColorProperty, Colors.Cyan); - Assert.Equal(Colors.Cyan, item.BadgeTextColor); - } - - [Fact] - public void BadgeTextColorDataBinding() - { - var vm = new { TextColor = Colors.Magenta }; - var item = new ToolbarItem(); - item.BindingContext = vm; - item.SetBinding(ToolbarItem.BadgeTextColorProperty, "TextColor"); - Assert.Equal(Colors.Magenta, item.BadgeTextColor); - } - - [Fact] - public void SetBadgeTextEmptyStringForDotBadge() - { - var item = new ToolbarItem(); - item.BadgeText = ""; - Assert.Equal("", item.BadgeText); - } - - [Fact] - public void EmptyStringBadgeIsDistinctFromNull() - { - var item = new ToolbarItem(); - item.BadgeText = ""; - Assert.NotNull(item.BadgeText); - item.BadgeText = null; - Assert.Null(item.BadgeText); - } - - [Fact] - public void EmptyStringBadgeFiresPropertyChanged() - { - var item = new ToolbarItem(); - bool fired = false; - item.PropertyChanged += (s, e) => - { - if (e.PropertyName == nameof(ToolbarItem.BadgeText)) - fired = true; - }; - item.BadgeText = ""; - Assert.True(fired); - } - } -} diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgeColorChanges.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgeColorChanges.png deleted file mode 100644 index 5915d3cab4cc..000000000000 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgeColorChanges.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgesClear.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgesClear.png deleted file mode 100644 index 33dfffb8d2f5..000000000000 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgesClear.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgesDisplay.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgesDisplay.png deleted file mode 100644 index dd8be953745a..000000000000 Binary files a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ToolbarItemBadgesDisplay.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue8305_Toolbar.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue8305_Toolbar.cs deleted file mode 100644 index 185f7cc32887..000000000000 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue8305_Toolbar.cs +++ /dev/null @@ -1,119 +0,0 @@ -using Microsoft.Maui.Controls; -using Microsoft.Maui.Graphics; - -namespace Maui.Controls.Sample.Issues; - -[Issue(IssueTracker.Github, 8305, "ToolbarItem Badge Support", PlatformAffected.All)] -public class Issue8305_Toolbar : ContentPage -{ - readonly ToolbarItem _badgeTextItem; - readonly ToolbarItem _badgeCountItem; - readonly ToolbarItem _badgeColorItem; - readonly Label _statusLabel; - int _count; - - public Issue8305_Toolbar() - { - Title = "ToolbarItem Badges"; - - _badgeTextItem = new ToolbarItem - { - Text = "Mail", - IconImageSource = "envelope.png", - BadgeText = "New", - AutomationId = "BadgeTextItem" - }; - _badgeTextItem.Clicked += (s, e) => _statusLabel.Text = "Tapped: Mail"; - - _badgeCountItem = new ToolbarItem - { - Text = "Alerts", - IconImageSource = "bell.png", - BadgeText = "3", - AutomationId = "BadgeCountItem" - }; - _badgeCountItem.Clicked += (s, e) => _statusLabel.Text = "Tapped: Alerts"; - - _badgeColorItem = new ToolbarItem - { - Text = "Cart", - IconImageSource = "cart.png", - BadgeText = "1", - BadgeColor = Colors.Green, - AutomationId = "BadgeColorItem" - }; - _badgeColorItem.Clicked += (s, e) => _statusLabel.Text = "Tapped: Cart"; - - ToolbarItems.Add(_badgeTextItem); - ToolbarItems.Add(_badgeCountItem); - ToolbarItems.Add(_badgeColorItem); - - _statusLabel = new Label - { - Text = "Tap toolbar items or use buttons below", - AutomationId = "StatusLabel" - }; - - _count = 3; - - Content = new ScrollView - { - Content = new VerticalStackLayout - { - Spacing = 10, - Padding = 20, - Children = - { - _statusLabel, - new Button - { - Text = "Increment Count Badge", - AutomationId = "IncrementButton", - Command = new Command(() => - { - _count++; - _badgeCountItem.BadgeText = _count.ToString(); - _statusLabel.Text = $"Count badge: {_count}"; - }) - }, - new Button - { - Text = "Clear All Badges", - AutomationId = "ClearBadgesButton", - Command = new Command(() => - { - _badgeTextItem.BadgeText = null; - _badgeCountItem.BadgeText = null; - _badgeColorItem.BadgeText = null; - _statusLabel.Text = "All badges cleared"; - }) - }, - new Button - { - Text = "Set Badge Color Red", - AutomationId = "SetRedColorButton", - Command = new Command(() => - { - _badgeColorItem.BadgeColor = Colors.Red; - _statusLabel.Text = "Badge color: Red"; - }) - }, - new Button - { - Text = "Restore Badges", - AutomationId = "RestoreBadgesButton", - Command = new Command(() => - { - _count = 3; - _badgeTextItem.BadgeText = "New"; - _badgeCountItem.BadgeText = "3"; - _badgeColorItem.BadgeText = "1"; - _badgeColorItem.BadgeColor = Colors.Green; - _statusLabel.Text = "Badges restored"; - }) - } - } - } - }; - } -} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8305_Toolbar.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8305_Toolbar.cs deleted file mode 100644 index 140dfdb905d2..000000000000 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8305_Toolbar.cs +++ /dev/null @@ -1,71 +0,0 @@ -using NUnit.Framework; -using UITest.Appium; -using UITest.Core; - -namespace Microsoft.Maui.TestCases.Tests.Issues; - -public class Issue8305_Toolbar : _IssuesUITest -{ - public override string Issue => "ToolbarItem Badge Support"; - - public Issue8305_Toolbar(TestDevice device) : base(device) { } - - [Test] - [Category(UITestCategories.ToolbarItem)] - public void ToolbarItemBadgesDisplay() - { - // Wait for the page to load (toolbar items aren't directly accessible via Appium on all platforms) - App.WaitForElement("StatusLabel"); - - // Take a screenshot showing badges (retryTimeout for async Android badge rendering) - VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)); - } - - [Test] - [Category(UITestCategories.ToolbarItem)] - public void ToolbarItemBadgeIncrements() - { - App.WaitForElement("IncrementButton"); - - // Increment the count badge - App.Tap("IncrementButton"); - - // Verify the status label updated - var text = App.FindElement("StatusLabel").GetText(); - Assert.That(text, Is.EqualTo("Count badge: 4")); - } - - [Test] - [Category(UITestCategories.ToolbarItem)] - public void ToolbarItemBadgesClear() - { - App.WaitForElement("ClearBadgesButton"); - - // Clear all badges - App.Tap("ClearBadgesButton"); - - // Verify status - var text = App.FindElement("StatusLabel").GetText(); - Assert.That(text, Is.EqualTo("All badges cleared")); - - // Take a screenshot showing no badges (retryTimeout for async Android badge rendering) - VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)); - } - - [Test] - [Category(UITestCategories.ToolbarItem)] - public void ToolbarItemBadgeColorChanges() - { - App.WaitForElement("SetRedColorButton"); - - // Change badge color to red - App.Tap("SetRedColorButton"); - - // Verify status - var text = App.FindElement("StatusLabel").GetText(); - Assert.That(text, Is.EqualTo("Badge color: Red")); - - // Take a screenshot showing red badge color (retryTimeout for async Android badge rendering) - VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)); - } -} diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgeColorChanges.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgeColorChanges.png deleted file mode 100644 index 3b0893887750..000000000000 Binary files a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgeColorChanges.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgesClear.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgesClear.png deleted file mode 100644 index b57ee019b570..000000000000 Binary files a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgesClear.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgesDisplay.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgesDisplay.png deleted file mode 100644 index f5c822f08146..000000000000 Binary files a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/ToolbarItemBadgesDisplay.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgeColorChanges.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgeColorChanges.png deleted file mode 100644 index ffac5cf57ec7..000000000000 Binary files a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgeColorChanges.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgesClear.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgesClear.png deleted file mode 100644 index b6fc93a5a341..000000000000 Binary files a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgesClear.png and /dev/null differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgesDisplay.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgesDisplay.png deleted file mode 100644 index a09eb9f37281..000000000000 Binary files a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ToolbarItemBadgesDisplay.png and /dev/null differ diff --git a/src/Core/maps/src/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Core/maps/src/PublicAPI/net/PublicAPI.Unshipped.txt index 1685a9844c5f..8c8b74ee66bd 100644 --- a/src/Core/maps/src/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Core/maps/src/PublicAPI/net/PublicAPI.Unshipped.txt @@ -1,11 +1,13 @@ #nullable enable Microsoft.Maui.Maps.IMap.ClusterClicked(System.Collections.Generic.IReadOnlyList! pins, Microsoft.Maui.Devices.Sensors.Location! location) -> bool +Microsoft.Maui.Maps.IMap.HideInfoWindow(Microsoft.Maui.Maps.IMapPin pin) -> void Microsoft.Maui.Maps.IMap.HideInfoWindow(Microsoft.Maui.Maps.IMapPin! pin) -> void Microsoft.Maui.Maps.IMap.IsClusteringEnabled.get -> bool Microsoft.Maui.Maps.IMap.LastUserLocation.get -> Microsoft.Maui.Devices.Sensors.Location? Microsoft.Maui.Maps.IMap.LongClicked(Microsoft.Maui.Devices.Sensors.Location! position) -> void Microsoft.Maui.Maps.IMap.MapStyle.get -> string? Microsoft.Maui.Maps.IMap.MoveToRegion(Microsoft.Maui.Maps.MapSpan! region, bool animated) -> void +Microsoft.Maui.Maps.IMap.ShowInfoWindow(Microsoft.Maui.Maps.IMapPin pin) -> void Microsoft.Maui.Maps.IMap.ShowInfoWindow(Microsoft.Maui.Maps.IMapPin! pin) -> void Microsoft.Maui.Maps.IMap.UserLocationUpdated(Microsoft.Maui.Devices.Sensors.Location! location) -> void Microsoft.Maui.Maps.IMapElement.Clicked() -> void diff --git a/src/TestUtils/src/DeviceTests.Runners/HeadlessRunner/iOS/MauiTestApplicationDelegate.cs b/src/TestUtils/src/DeviceTests.Runners/HeadlessRunner/iOS/MauiTestApplicationDelegate.cs index 503938c22c30..e0b8355c73c0 100644 --- a/src/TestUtils/src/DeviceTests.Runners/HeadlessRunner/iOS/MauiTestApplicationDelegate.cs +++ b/src/TestUtils/src/DeviceTests.Runners/HeadlessRunner/iOS/MauiTestApplicationDelegate.cs @@ -84,7 +84,7 @@ protected MauiTestApplicationDelegate() public override bool WillFinishLaunching(UIApplication application, NSDictionary? launchOptions) { - Runtime.MarshalManagedException += (object? sender, MarshalManagedExceptionEventArgs args) => + Runtime.MarshalManagedException += (object sender, MarshalManagedExceptionEventArgs args) => { Console.WriteLine("Marshaling managed exception"); Console.WriteLine(" Exception: {0}", args.Exception); @@ -92,7 +92,7 @@ public override bool WillFinishLaunching(UIApplication application, NSDictionary }; - Runtime.MarshalObjectiveCException += (object? sender, MarshalObjectiveCExceptionEventArgs args) => + Runtime.MarshalObjectiveCException += (object sender, MarshalObjectiveCExceptionEventArgs args) => { Console.WriteLine("Marshaling Objective-C exception"); Console.WriteLine(" Exception: {0}", args.Exception); diff --git a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs index e5c9c109cc34..5b48acba0e39 100644 --- a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs +++ b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs @@ -247,15 +247,14 @@ public static Task ToBitmap(this UIView view, IMauiContext mauiContext) #pragma warning disable CA1416 // Validate platform compatibility UIGraphics.BeginImageContext(imageRect.Size); var context = UIGraphics.GetCurrentContext(); - if (context is not null) - view.Layer.RenderInContext(context); + view.Layer.RenderInContext(context); var image = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); #pragma warning restore CA1416 // Validate platform compatibility - logger?.LogDebug($"Finish: {image?.Size}"); + logger?.LogDebug($"Finish: {image.Size}"); - return Task.FromResult(image!); + return Task.FromResult(image); } public static UIColor ColorAtPoint(this UIImage bitmap, int x, int y) diff --git a/src/TestUtils/src/DeviceTests/UINSWindow.iOS.cs b/src/TestUtils/src/DeviceTests/UINSWindow.iOS.cs index ad5e2b94cfc1..b21022573959 100644 --- a/src/TestUtils/src/DeviceTests/UINSWindow.iOS.cs +++ b/src/TestUtils/src/DeviceTests/UINSWindow.iOS.cs @@ -79,27 +79,19 @@ public void SetFrame(CGRect frame, bool display = true, bool animate = true) return null; var sharedApp = nsapp.PerformSelector(SharedApplicationSelector); - if (sharedApp is null) - return null; - var windows = sharedApp.PerformSelector(WindowsSelector) as NSArray; - if (windows is null) - return null; - for (nuint i = 0; i < windows.Count; i++) + for (nuint i = 0; i < windows!.Count; i++) { var nswin = windows.GetItem(i); - if (nswin is null) - continue; - if (nswin.PerformSelector(UIWindowsSelector) is not NSArray uiwindows) - continue; + var uiwindows = nswin.PerformSelector(UIWindowsSelector) as NSArray; - for (nuint j = 0; j < uiwindows.Count; j++) + for (nuint j = 0; j < uiwindows!.Count; j++) { var uiwin = uiwindows.GetItem(j); - if (uiwin is not null && uiwin.Handle == uiWindow.Handle) + if (uiwin.Handle == uiWindow.Handle) return new UINSWindow(nswin.Handle, uiWindow); } }