Skip to content

Conversation

Copy link

Copilot AI commented Nov 24, 2025

GitHub Issue (If applicable): closes #[issue_number]

PR Type

  • Feature

What is the current behavior?

MainCommandMode has two values: Back (automatic back navigation) and Action (custom behavior with visible button). To completely hide the MainCommand, users must set MainCommandMode.Action and manually configure MainCommand.Visibility = Collapsed, which is non-obvious.

What is the new behavior?

Added MainCommandMode.Hidden that automatically collapses the MainCommand regardless of Frame backstack state.

Usage:

<utu:NavigationBar Content="Home" MainCommandMode="Hidden" />

Implementation:

  • Enum: Added Hidden value to MainCommandMode enum
  • Visibility Logic: UpdateMainCommandVisibility() now checks for Hidden mode first and sets Visibility.Collapsed
  • Navigation Logic: TryPerformMainCommand() returns false for Hidden mode (no automatic navigation)
  • Platform Support: Works across Windows/iOS/Android as native renderers already check Visibility.Visible

Tests:

  • MainCommand_Hidden_Mode_Hides_Button(): Verifies button is collapsed
  • MainCommand_Hidden_Mode_In_Frame_Stays_Hidden(): Verifies button stays hidden with backstack

PR Checklist

Other information

No platform-specific changes required. Native iOS/Android renderers respect Visibility property automatically.

Internal Issue (If applicable):

Original prompt

This section details on the original issue you should resolve

<issue_title>[NavigationBar] Clarify how to completely hide the MainCommand</issue_title>
<issue_description>Currently, we document the usage of MainCommandMode being set to Action as a way to override the default behaviour of the MainCommand from the NavigationBar here: https://platform.uno/docs/articles/external/uno.toolkit.ui/doc/controls/[NavigationBar](https://platform.uno/docs/articles/external/uno.toolkit.ui/doc/controls/NavigationBar.html#maincommandmode).html#maincommandmode

We should document clearly that this will result in the MainCommand still being visible as it is assuming you still want it to display and customize the behavior when clicked.

There are scenarios where you may want to completely hide the MainCommand at all times. For that to work, we would need to document that you should be setting the MainCommandMode to Action as well as defining a MainCommand with the Visibility of the AppBarButton set to Collapsed. We should also perhaps add a new Hidden option for the MainCommandMode that would effectively do this for the user.</issue_description>

<agent_instructions>We should also implement the suggestion of the Hidden value for the MainCommandMode as detailed in the last sentence on the issue description</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Custom agent used: toolkit-bug-fix-bot
Identifies critical bugs in your project and implements targeted fixes with working code


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Clarify MainCommand visibility in NavigationBar documentation feat: Add MainCommandMode.Hidden to completely hide NavigationBar MainCommand Nov 24, 2025
Copilot AI requested a review from kazo0 November 24, 2025 16:13
Copilot finished work on behalf of kazo0 November 24, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NavigationBar] Clarify how to completely hide the MainCommand

3 participants