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

NavigationView: Fixing visibility of close button in Auto PaneDisplayMode and Minimal DisplayMode #1195

Merged
merged 1 commit into from
Aug 24, 2019

Conversation

RBrid
Copy link
Contributor

@RBrid RBrid commented Aug 22, 2019

Fixes Issue #563.

When the NavigationView pane is open, not only must the new Close button be displayed when PaneDisplayMode is LeftMinimal, it must also appear when the PaneDisplayMode is Auto and the DisplayMode is Minimal.
Only the NavigationView::ShouldShowCloseButton() method had to be tweaked to make that happen.

I added a new VerifyBackAndCloseButtonsVisibilityInAutoPaneDisplayMode test to cover that scenario.

@RBrid RBrid requested a review from a team as a code owner August 22, 2019 20:37
@RBrid RBrid self-assigned this Aug 22, 2019
@jevansaks jevansaks added area-NavigationView NavView control bug Something isn't working release note PR that we want to call out in the next release summary labels Aug 22, 2019
auto paneDisplayMode = PaneDisplayMode();

if (paneDisplayMode != winrt::NavigationViewPaneDisplayMode::LeftMinimal &&
(paneDisplayMode != winrt::NavigationViewPaneDisplayMode::Auto || DisplayMode() != winrt::NavigationViewDisplayMode::Minimal))
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between paneDisplayMode and DisplayMode()?
Is NavigationViewDisplayMode::Minimal a sub-state of NavigationViewPaneDisplayMode::Auto? If so maybe something like below is easier to understand?

paneDisplayMode != winrt::NavigationViewPaneDisplayMode::LeftMinimal &&
!(paneDisplayMode == winrt::NavigationViewPaneDisplayMode::Auto && DisplayMode() == winrt::NavigationViewDisplayMode::Minimal)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yulia told me this weird design was the result of feature additions during the lifespan of the control. PaneDisplayMode is read-write while DisplayMode is read-only. One PaneDisplayMode implies one of several DisplayMode values, depending on various factors. Minimal may be set for Auto and LeftMinimal. I'm sure this design would not have been picked if all today's features had existing from the beginning.
Another way of expressing the condition would have been:

if (!(paneDisplayMode == winrt::NavigationViewPaneDisplayMode::LeftMinimal ||
      (paneDisplayMode == winrt::NavigationViewPaneDisplayMode::Auto && DisplayMode() == winrt::NavigationViewDisplayMode::Minimal)))
{
    return false;
}

or your expression. None of them are trivial - I'll just leave it as is.

@RBrid RBrid merged commit 27d6b33 into master Aug 24, 2019
@RBrid RBrid deleted the user/rbrid/NavigationViewCloseButtonInMinimalMode branch August 24, 2019 01:55
@msft-github-bot
Copy link
Collaborator

🎉Microsoft.UI.Xaml v2.2.190830001 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NavigationView NavView control bug Something isn't working release note PR that we want to call out in the next release summary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants