Skip to content
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

Add AlwaysExpanded property to CommandBarFlyout #4532

Merged
merged 5 commits into from
Mar 23, 2021

Conversation

teaP
Copy link
Contributor

@teaP teaP commented Mar 15, 2021

If set to True, AlwaysExpanded makes the CommandBarFlyout open with the secondary command list visible, and removes the ... button which normally toggles the secondary menu.

This also fixes a bug in CommandBar and CommandBarFlyout where if the ... button is hidden there's no margin between the last command and the edge of the control.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Mar 15, 2021
@ranjeshj ranjeshj added area-Commanding AppBar, UICommand, MVVM, etc team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Mar 15, 2021
@teaP teaP requested a review from anawishnoff March 15, 2021 20:59
@teaP
Copy link
Contributor Author

teaP commented Mar 15, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

// When CommandBarFlyout is in AlwaysOpen state, don't show the overflow button
if (AlwaysExpanded())
{
commandBar.IsOpen(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

commandBar.IsOpen(true); [](start = 20, length = 24)

Why does AlwaysExpanded affect if we open the commandbar (not the overflow flyout)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CommandBar IsOpen is actually about the overflow flyout! It's unfortunately a bit confusing.

if (AlwaysExpanded())
{
commandBar.IsOpen(true);
commandBar.OverflowButtonVisibility(winrt::Windows::UI::Xaml::Controls::CommandBarOverflowButtonVisibility::Collapsed);
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we have to do something to show the overflow items?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above comment.

@@ -813,7 +814,7 @@
XYFocusKeyboardNavigation="Enabled">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="{StaticResource AppBarRightMargin}"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

AppBarRightMargin [](start = 89, length = 17)

How is this a margin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a right margin -- basically, if the MoreButton isn't visible, it ensures a right margin between the command buttons and the edge of the control. But I can rename it if that's the issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a rename is appropriate, in xaml margin's are of type thickness, which this is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, renamed to AppBarMoreButtonColumnMinWidth.

@robloo
Copy link
Contributor

robloo commented Mar 16, 2021

Why isn't this named IsAlwaysExpanded? what happened to WinUI following the .NET naming conventions more-or-less for public APIs?

@teaP
Copy link
Contributor Author

teaP commented Mar 17, 2021

Why isn't this named IsAlwaysExpanded? what happened to WinUI following the .NET naming conventions more-or-less for public APIs?

Since AlwaysExpanded doesn't sound like an event, it doesn't require the "is". It's been approved by our naming gurus.

@robloo
Copy link
Contributor

robloo commented Mar 17, 2021

Why isn't this named IsAlwaysExpanded? what happened to WinUI following the .NET naming conventions more-or-less for public APIs?

Since AlwaysExpanded doesn't sound like an event, it doesn't require the "is". It's been approved by our naming gurus.

The guidelines state "✔️ DO name Boolean properties with an affirmative phrase (CanSeek instead of CantSeek). Optionally, you can also prefix Boolean properties with "Is", "Can", or "Has", but only where it adds value."

While the guidelines give lots of leeway there is an expectation that "Is" goes before bool properties. The "Is" prefix has been well established for well over a decade now. There has never been any requirement that "Is" is only added when it could be confused with an event (although it would certainly add value there). The concerns usually occur if there are grammatical issues and then "Has" or some alternatives are considered.

@teaP
Copy link
Contributor Author

teaP commented Mar 22, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

Why isn't this named IsAlwaysExpanded? what happened to WinUI following the .NET naming conventions more-or-less for public APIs?

Since AlwaysExpanded doesn't sound like an event, it doesn't require the "is". It's been approved by our naming gurus.

The guidelines state "✔️ DO name Boolean properties with an affirmative phrase (CanSeek instead of CantSeek). Optionally, you can also prefix Boolean properties with "Is", "Can", or "Has", but only where it adds value."

While the guidelines give lots of leeway there is an expectation that "Is" goes before bool properties. The "Is" prefix has been well established for well over a decade now. There has never been any requirement that "Is" is only added when it could be confused with an event (although it would certainly add value there). The concerns usually occur if there are grammatical issues and then "Has" or some alternatives are considered.

I think I agree, but the API is marked as preview, so we can change it during API review.

@teaP
Copy link
Contributor Author

teaP commented Mar 22, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@teaP
Copy link
Contributor Author

teaP commented Mar 23, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@teaP teaP merged commit 4e774f7 into master Mar 23, 2021
@teaP teaP deleted the user/teaP/CommandBarAlwaysExpanded branch March 23, 2021 19:01
Kinnara added a commit to Kinnara/ModernWpf that referenced this pull request Nov 20, 2023
Kinnara added a commit to Kinnara/ModernWpf that referenced this pull request Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Commanding AppBar, UICommand, MVVM, etc team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants