KEMBAR78
Implement iOS/macOS secondary ToolbarItems - Shell by kubaflo · Pull Request #30480 · dotnet/maui · GitHub
Skip to content

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 #30674
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 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;

return new PrimaryToolbarItem(item, forceName);
}

internal static SecondarySubToolbarItem ToSecondarySubToolbarItem(this ToolbarItem item)
Copy link

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.

@kubaflo kubaflo changed the base branch from main to net10.0 July 8, 2025 00:02
@kubaflo kubaflo self-assigned this Jul 8, 2025
@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

@azure-pipelines
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
@kubaflo
Copy link
Contributor Author

kubaflo commented Jul 10, 2025

I'm waiting for net10 preview6 to continue working on this PR, but I cannot switch it to draft

@kubaflo kubaflo force-pushed the ios-secondary-toolbaritem-shell-pages branch from c054fcf to fc992ee Compare July 16, 2025 23:14
@kubaflo
Copy link
Contributor Author

kubaflo commented Jul 16, 2025

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)

Fixed

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

jfversluis
jfversluis previously approved these changes Jul 18, 2025
@PureWeen PureWeen moved this from Changes Requested to Approved in MAUI SDK Ongoing Jul 19, 2025
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

  • failing test unrelated

@PureWeen PureWeen merged commit 970cb25 into dotnet:net10.0 Jul 23, 2025
127 of 129 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Jul 23, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-toolbar ToolBar community ✨ Community Contribution p/0 Work that we can't release without platform/ios proposal/open

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Enhancement] Better ToolbarItem (Secondary)

4 participants