-
Notifications
You must be signed in to change notification settings - Fork 705
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
Let NavigationViewItem respect CompactPane length for icon size #2051
Conversation
dev/NavigationView/NavigationView_InteractionTests/NavigationViewTests.cs
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This should have fixed the recent test failure. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingucoding, can you please merge with master ? |
Done with 8a96a4f |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Co-Authored-By: Stephen L Peters <stpete@microsoft.com>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -1358,6 +1362,36 @@ void NavigationView::UpdateIsClosedCompact() | |||
} | |||
} | |||
|
|||
void NavigationView::UpdatePaneButtonsWidths() |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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):