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

Let NavigationViewItem respect CompactPane length for icon size #2051

Merged

Conversation

marcelwgn
Copy link
Collaborator

@marcelwgn marcelwgn commented Mar 1, 2020

Description

This changes the way the NavigationView(Item) deals with CompactPane length and updates it's layout accordingly to prevent text clipping on customly set CompactPaneLength values.

Motivation and Context

Fixes #1742

How Has This Been Tested?

Added new interaction test.

Screenshots (if appropriate):

naview-customcompactpanelength

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Mar 1, 2020
@ranjeshj ranjeshj requested a review from ojhad March 2, 2020 16:49
@ranjeshj
Copy link
Contributor

ranjeshj commented Mar 2, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters StephenLPeters added area-NavigationView NavView control team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Mar 3, 2020
@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@marcelwgn
Copy link
Collaborator Author

This should have fixed the recent test failure.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@StephenLPeters StephenLPeters left a comment

Choose a reason for hiding this comment

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

:shipit:

@ranjeshj
Copy link
Contributor

ranjeshj commented Apr 1, 2020

@chingucoding, can you please merge with master ?

@marcelwgn
Copy link
Collaborator Author

Done with 8a96a4f

@ranjeshj
Copy link
Contributor

ranjeshj commented Apr 1, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Co-Authored-By: Stephen L Peters <stpete@microsoft.com>
@kmahone
Copy link
Member

kmahone commented Apr 1, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ojhad ojhad merged commit 7423909 into microsoft:master Apr 8, 2020
@@ -1358,6 +1362,36 @@ void NavigationView::UpdateIsClosedCompact()
}
}

void NavigationView::UpdatePaneButtonsWidths()
Copy link
Contributor

@Kinnara Kinnara Apr 12, 2020

Choose a reason for hiding this comment

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

UpdatePaneButtonsWidths needs to be called in OnApplyTemplate as well to handle a non-default initial value of CompactPaneLength.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is indeed a problem. Calling UpdatePaneButtonWidths in ´OnApplyTemplate` does not fix this however.

I've created a tracking issue for that: #2277

{
auto width = paneToggleButtonIconColumn.Width();
width.Value = newButtonWidths;
paneToggleButtonIconColumn.Width(width);
Copy link
Contributor

@Kinnara Kinnara Apr 12, 2020

Choose a reason for hiding this comment

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

If Width of the icon column always equals MinWidth of the parent pane toggle button, it should be possible to use a binding in PaneToggleButtonStyle to achieve the same result?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes that should work, but it's propably faster if we handle that switching ourselves.

Copy link
Contributor

Choose a reason for hiding this comment

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

The binding approach would be more robust though. For example, if the pane toggle button is initially hidden (IsPaneToggleButtonVisible="False") and later made visible, then this piece of code won't be able to get the icon column since the button's template won't be applied until it's visible. To handle this (rare) situation, additional logic would need to be added, which could result in more complexity than necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since we don't lazy load the control, as soon as we "ask for it" through GetTemplateChild the element get's realized and we can change it's state, so this should be a non issue right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NavigationView NavView control team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NavigationViewItem template should respect CompactPaneLength
8 participants