Skip to content

Implement iOS/macOS secondary ToolbarItems - Shell #30480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: net10.0
Choose a base branch
from

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jul 8, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

This PR is an extension for @jfversluis one's #28185 which implements iOS/macOS secondary ToolbarItems for shell pages

Issues Fixed

Fixes #815

Before After
Screen.Recording.2025-07-08.at.01.45.07.mov

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 00:00
@kubaflo kubaflo requested a review from a team as a code owner July 8, 2025 00:00
@kubaflo kubaflo requested review from jfversluis and mattleibow July 8, 2025 00:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for secondary toolbar items in Shell on iOS/macOS by introducing a new pull-down menu for items marked Secondary, and also updates the DatePicker API to allow nullable dates.

  • Added ToSecondarySubToolbarItem extension and SecondarySubToolbarItem class
  • Modified Shell handlers to group secondary items under a menu button with configurable icon
  • Changed DatePicker properties and event args to use DateTime? for nullable support

Reviewed Changes

Copilot reviewed 287 out of 1121 changed files in this pull request and generated 2 comments.

File Description
src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs Added ToSecondarySubToolbarItem extension and SecondarySubToolbarItem class
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs Updated UpdateToolbarItems to insert secondary items into a pull-down menu
src/Controls/src/Core/DatePicker/DatePicker.cs Changed bindable Date, MinimumDate, MaximumDate and related APIs to nullable DateTime?
Comments suppressed due to low confidence (1)

src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs:391

  • Typo: Viewco is undefined; this should be ViewController to correctly reference the view controller instance.
					break;

@@ -25,6 +27,31 @@ public static UIBarButtonItem ToUIBarButtonItem(this ToolbarItem item, bool forc
return new PrimaryToolbarItem(item, forceName);
}

internal static SecondarySubToolbarItem ToSecondarySubToolbarItem(this ToolbarItem item)
Copy link
Preview

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add automated UI tests in TestCases.HostApp and TestCases.Shared.Tests to cover the new SecondarySubToolbarItem functionality so secondary toolbar menus are validated end-to-end.

Copilot uses AI. Check for mistakes.

@@ -14,17 +14,17 @@ public partial class DatePicker : View, IFontElement, ITextElement, IElementConf
public static readonly BindableProperty FormatProperty = BindableProperty.Create(nameof(Format), typeof(string), typeof(DatePicker), "d");

/// <summary>Bindable property for <see cref="Date"/>.</summary>
public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(DatePicker), default(DateTime), BindingMode.TwoWay,
public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime?), typeof(DatePicker), null, BindingMode.TwoWay,
Copy link
Preview

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the Date bindable property's CLR type from DateTime to DateTime? is a public API signature change and may be breaking; ensure this is acceptable for a minor release.

Copilot uses AI. Check for mistakes.

@kubaflo kubaflo changed the base branch from main to net10.0 July 8, 2025 00:02
@kubaflo kubaflo self-assigned this Jul 8, 2025
Copy link
Contributor

Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 8, 2025
@PureWeen
Copy link
Member

PureWeen commented Jul 8, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen added the p/0 Work that we can't release without label Jul 8, 2025
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some build errors:

C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(395,9): error CS0103: The name 'Viewco' does not exist in the current context [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-ios18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(397,22): error CS0103: The name 'navRenderer' does not exist in the current context [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-ios18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(394,29): error CS8600: Converting null literal or possible null value to non-nullable type. [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-ios18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(402,22): error CS8600: Converting null literal or possible null value to non-nullable type. [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-ios18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(395,9): error CS0103: The name 'Viewco' does not exist in the current context [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-maccatalyst18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(397,22): error CS0103: The name 'navRenderer' does not exist in the current context [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-maccatalyst18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(394,29): error CS8600: Converting null literal or possible null value to non-nullable type. [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-maccatalyst18.5]
C:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\iOS\ShellPageRendererTracker.cs(402,22): error CS8600: Converting null literal or possible null value to non-nullable type. [C:\a\_work\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-maccatalyst18.5]
    8 Error(s)

@github-project-automation github-project-automation bot moved this from Todo to Changes Requested in MAUI SDK Ongoing Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-toolbar ToolBar community ✨ Community Contribution p/0 Work that we can't release without platform/ios proposal/open
Projects
Status: Changes Requested
Development

Successfully merging this pull request may close these issues.

[Enhancement] Better ToolbarItem (Secondary)
3 participants