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

Layout Cycle Crash + Misc Fixes for NavigationView #5084

Merged
merged 22 commits into from
Jun 12, 2021

Conversation

karkarl
Copy link
Contributor

@karkarl karkarl commented May 24, 2021

Description

Layout Cycle Crash Fix:

UpdatePaneLayout() was calculating Separator and Footer height from hardcoded values. The discrepancy from the template was causing ScrollViewer to continuously calculate incrementally different heights and crashing.

It is now refactored to include all footer group items (footerItemsRepeater paneFooter, VisualItemsSeparator) and its margins top and bottom.

Miscellaneous fixes

  • Update brushes
  • Expose certain themeresources
  • Fix separator margins

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label May 24, 2021
@karkarl karkarl requested a review from gabbybilka May 24, 2021 22:09
@karkarl
Copy link
Contributor Author

karkarl commented May 24, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj ranjeshj added area-NavigationView NavView control team-Controls Issue for the Controls team area-Styling and removed needs-triage Issue needs to be triaged by the area owners labels May 24, 2021
@karkarl
Copy link
Contributor Author

karkarl commented May 25, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

@marcelwgn marcelwgn left a comment

Choose a reason for hiding this comment

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

LGTM

@karkarl
Copy link
Contributor Author

karkarl commented Jun 1, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl
Copy link
Contributor Author

karkarl commented Jun 4, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl karkarl changed the title Miscellaneous Fixes for NavigationView Layout Cycle Crash + Misc Fixes for NavigationView Jun 10, 2021
@karkarl
Copy link
Contributor Author

karkarl commented Jun 10, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

}();

// Footer, PaneFooter, and VisualItemsSeparator are included in the footerGroup to calculate available height for menu items.
const auto footerGroupActualHeight = footersActualHeight + paneFooterActualHeight + visualItemsSeparatorHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding the visualItemsSeparatorHeight feels incorrect to me: you don't want the separator to be shown because of a lack of space due to the separator being shown. You know what I mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that too... but it was part of the calculation before so I simply included it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline, will remove.

@karkarl
Copy link
Contributor Author

karkarl commented Jun 10, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl
Copy link
Contributor Author

karkarl commented Jun 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

const auto footerGroupActualHeight = footersActualHeight + paneFooterActualHeight + visualItemsSeparatorHeight;
// This is the value computed during the measure pass of the layout process. This will be the value used to determine
// the partition logic between menuItems and footerGroup, since the ActualHeight may be taller if there's more space.
const auto menuItemsDesiredHeight = menuItems.DesiredSize().Height + menuItemsTopBottomMargin;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unlike ActualHeight/ActualWidth, UIElement.DesiredSize already includes the Margin. So it should be:

const auto menuItemsDesiredHeight = menuItems.DesiredSize().Height;

@karkarl
Copy link
Contributor Author

karkarl commented Jun 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@RBrid RBrid self-requested a review June 11, 2021 17:52
@RBrid
Copy link
Contributor

RBrid commented Jun 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Comment on lines 188 to 191
<VisualState x:Name="SeparatorVisible"/>
<VisualState x:Name="SeparatorCollapsed">
<VisualState.Setters>
<Setter Target="VisualItemsSeparator.Visibility" Value="Visible"/>
<Setter Target="VisualItemsSeparator.Visibility" Value="Collapsed"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity, why is this switched now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh oops. I was previously getting the separator ActualHeight from codebehind, and for it to evaluate to a non-zero value, it needed to be visible by default. The separator is no longer used for pane layout calculations, so I should revert this.

@karkarl
Copy link
Contributor Author

karkarl commented Jun 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karkarl
Copy link
Contributor Author

karkarl commented Jun 11, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj ranjeshj merged commit 9738f87 into main Jun 12, 2021
@ranjeshj ranjeshj deleted the user/karenlai/NavViewLayeringTest branch June 12, 2021 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NavigationView NavView control area-Styling team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants