-
Notifications
You must be signed in to change notification settings - Fork 706
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
NavView: Expand/Collapse chevron and Overflow button improvements in Top mode #3063
Changes from all commits
2b1145d
c5cb50a
d145698
b5ed60e
f467596
d9a7789
787c0b2
a852c6d
f8da599
4471ccd
c8b7a95
f5b27c1
0909d87
a56b2c0
bfcb391
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -567,7 +567,6 @@ public void VerifyAutomationPeerExpandCollapsePatternBehavior() | |
}); | ||
} | ||
|
||
|
||
[TestMethod] | ||
public void VerifySettingsItemToolTip() | ||
{ | ||
|
@@ -854,5 +853,23 @@ public void VerifyExpandCollapseChevronVisibility() | |
}); | ||
} | ||
|
||
[TestMethod] | ||
public void VerifyOverflowButtonToolTip() | ||
{ | ||
RunOnUIThread.Execute(() => | ||
{ | ||
var navView = new NavigationView(); | ||
navView.PaneDisplayMode = NavigationViewPaneDisplayMode.Top; | ||
|
||
Content = navView; | ||
Content.UpdateLayout(); | ||
|
||
var overflowButton = VisualTreeUtils.FindVisualChildByName(navView, "TopNavOverflowButton") as Button; | ||
var toolTipObject = ToolTipService.GetToolTip(overflowButton); | ||
|
||
bool testCondition = toolTipObject is ToolTip toolTip && toolTip.Content.Equals("More"); | ||
Verify.IsTrue(testCondition, "ToolTip text should have been \"More\"."); | ||
}); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think testing that a custom tooltip isn't overwritten would be good too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does Content.UpdateLayout() cause NavigationView.ApplyTemplate() to run or do I need to use a new test here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ranjeshj do you know off the top of your head? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ApplyTemplate will be run before running the first layout pass. If you are asking if it will be run again on the next layout (UpdateLayout call), the answer is no. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There might be some trouble testing the custom tooltip not being overriden: Developers today would modify the existing <Style x:Key="NavigationViewOverflowButtonStyleWhenPaneOnTop" TargetType="Button">
<Setter Property="ToolTipService.ToolTip" Value="Custom tooltip" />
</Style> So in order to test that "Custom tooltip" is not being overriden, my thinking was to create a test NavigationView in code-behind containing that style and then check the tooltip content in an interaction test. However, I noticed that setting this style in the NavigationView.Resources scope, or even the Page level scope, does not apply the custom style at all: <muxc:NavigationView PaneDisplayMode="Top">
<muxc:NavigationView.Resources>
<Style x:Key="NavigationViewOverflowButtonStyleWhenPaneOnTop" TargetType="Button">
<Setter Property="Background" Value="Orange" />
<Setter Property="Foreground" Value="Green" />
<Setter Property="ToolTipService.ToolTip" Value="Custom tooltip" />
</Style>
</muxc:NavigationView.Resources>
</muxc:NavigationView> If I define that style on the app level it is being applied: I would expect here that my custom style defined on the page or control level would be picked up as well (just as how I can override theme resources on the page/control level) as the NavigationView overflow button in Top mode is neither in a Popup nor flyout. This immediately poses the problem that if I set that style on the app level, then my existing API test to check the default overflow button tooltip will fail as the tooltip content will now be my custom set tooltip. Thoughts on how to proceed here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a bug, you should be able to style this from any parent. If this is blocking the custom tooltip test I think its okay to leave that space uncovered until this new bug is resolved. |
||
} | ||
} |
Large diffs are not rendered by default.
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.
Do we need to do this from code behind or can we add this to the template?
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.
I have generally seen tooltips in WinUI only being added in code-behind (TabView and existing NavView tooltips, for example) so I am presuming this is the recommended way here.