-
Notifications
You must be signed in to change notification settings - Fork 712
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: Fix overflow button not being collapsed when the overflow menu only contains one item and NavigationView menu items are removed to empty the overflow menu #3087
NavigationView: Fix overflow button not being collapsed when the overflow menu only contains one item and NavigationView menu items are removed to empty the overflow menu #3087
Conversation
@Felix-Dev can you merge master to pick up the CI build fix that just went in? |
@Felix-Dev Ping in case updating this PR got missed |
@StephenLPeters Thanks for the ping, missed it indeed. Merged with master now. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@Felix-Dev do you understand why this is a template setting and not a visual state? Refers to: dev/NavigationView/NavigationView.cpp:3296 in a1d6b9f. [](commit_id = a1d6b9f, deletion_comment = False) |
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.
@StephenLPeters I'm afraid not. A visual state group for the overflow button visibility works perfectly fine here based on my tests (both manual and automatic ones). I'm not sure why this was made a public TemplateSettings API instead. Perhaps @ojhad knows more? We could, for now, change the internal logic of the NavigationView so that the visibility of the overflow button is controlled by a visual state group instead. The template settings updating logic would have to be kept, however, to avoid breaking changes. Barring additional info on the reasoning behing the TemplateSettings API, I would always prefer using visual states here. Thoughts? |
I also definitely prefer a visual state group to this template settings method... and also agree we can't remove it :'( @ojhad or @YuliKl do either of you know? |
I do not know what the use case in mind was when the decision was made to place this in template settings. |
Most of time, templatesetting is recommended:
In the start, using code to control visual is widely used, but it becauses harder and harder to maintain.
|
Of course, If we just make overflow button as an example, there is no significant difference to use "visual state" or templatesetting. |
Template settings has the very large downside of being an API though, which we can't change and have to cary with us everywhere we go. In general we've prefered using VSM to using template settings. However, your point about navigation view's measure override needing this explains why we need a template setting here. Thanks. |
I see. Thanks for the explanation, @licanhua! |
…flow menu only contains one item and NavigationView menu items are removed to empty the overflow menu (microsoft/microsoft-ui-xaml#3087)
Description
This PR fixes the top NavigationView's overflow button not being collapsed when the overflow menu only contains a single item and
Currently, the visibility of the overflow button is set during a NavigationView::MeasureOverride() run, however, that method is not called in the aforementioned cases. To update the visibility in those cases, we listen to changes to the internal overflow menu item collection and collapse the overflow button when that collection no longer contains any item.
Motivation and Context
Fixes #3086.
How Has This Been Tested?
Tested visually and added interaction test.
Gif:
(The GIF above shows the newly added test page for the interaction test.)