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

Hierarchical Navigation View #2004

Merged
merged 22 commits into from
Mar 22, 2020
Merged

Conversation

ojhad
Copy link
Contributor

@ojhad ojhad commented Feb 20, 2020

Description

Implemented functionality for multi level support.
These changes leverage the SelectionModel in order to support multi level selection.
Also this change includes breaking the NavigationViewItemBase dependency on ListViewItem and moving the pointer visual states logic into NavigationViewItem.

Motivation and Context

Part of task #1317
Part of task #79

How Has This Been Tested?

Manual testing and added some tests

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Feb 20, 2020
@ranjeshj ranjeshj removed the needs-triage Issue needs to be triaged by the area owners label Feb 20, 2020
@ojhad ojhad changed the title Hierarchical Navigation View Core Functionality (in progress) Hierarchical Navigation View (in progress) Feb 27, 2020
{
if (auto grid = element.try_as<winrt::Grid>())
{
return grid.Name() == c_flyoutRootGrid;
Copy link
Contributor

Choose a reason for hiding this comment

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

object comparison by a name property seems dangerous. who's to say there isn't a grid with this name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point. Currently this is the method that is being used to determine if an Item is being displayed in a flyout. I'll open a separate issue to update this so that it does not depend on the visual tree in order to gain this information.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ojhad Can you create an issue and link it here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ojhad ojhad force-pushed the user/ojhad/navigationviewhierarchical branch from 182e8f8 to 6615eed Compare March 10, 2020 23:55
@ojhad ojhad changed the title Hierarchical Navigation View (in progress) Hierarchical Navigation View Mar 13, 2020
contract7Present:Placement="RightEdgeAlignedTop">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="Padding" Value="0,8" />
Copy link
Contributor

Choose a reason for hiding this comment

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

0,8 [](start = 74, length = 3)

ideally these magic numbers could be exposed as static resources

Copy link

Choose a reason for hiding this comment

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

Agreed, resources would be great. I expect a small but non-zero percentage of customers wanting to customize the flyout padding. Is there an existing resource we can reuse that logically makes sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's definitely is a good idea. As of now, I can't think of an existing resource that we could re-use here, as I styled this flyout to be like the overflow flyout in TopNav, which does not expose these properties.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ojhad @YuliKl @StephenLPeters We could add two padding theme resources - one resource for the children flyouts (used in both Left and Top mode) and the second resource used for the overflow menu in Top mode.

Why two resources instead of one? Logically, the content of both flyouts differ. One flyout lists the children for a menu item, whereas the overflow flyout lists distinct top-level items (including their children if any). As such it could make sense to give customers the ability to choose a different padding for these two different flyout types.

Proposed theme resources:

  • TopNavigationViewOverflowMenuPadding
  • NavigationViewItemChildrenMenuFlyoutPadding

I'm proposing using "MenuFlyout" instead of just "Menu" for the children flyout padding theme resource as children can also be displayed inline (in Left mode) and I'm not sure if NavigationViewItemChildrenMenuPadding would make it clear that this resource only affects the padding when the children are displayed inside a flyout and not inline. As such, I picked "MenuFlyout" to make it crystal clear when the padding will be applied.
I don't believe adding "Flyout" to the TopNavigationViewOverflowMenuPadding name is required as the documentation also only speaks of the "overflow menu" and not the "overflow menu flyout".

Thoughts?

static constexpr auto c_enabled = L"Enabled"sv;
static constexpr auto c_normal = L"Normal"sv;
static constexpr auto c_chevronHidden = L"ChevronHidden"sv;
static constexpr auto c_chevronVisible = L"ChevronVisible"sv;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ideally you would include visual state names with these definitions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't get what you mean? These are visual state names.

Copy link
Contributor

@StephenLPeters StephenLPeters Mar 20, 2020

Choose a reason for hiding this comment

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

For instance you don't have these state names up here L"IconOnLeft" L"IconOnly" L"ContentOnly" names up here


In reply to: 394637672 [](ancestors = 394637672)

if (auto rootGrid = GetTemplateChildT<winrt::Grid>(c_rootGrid, controlProtected))
{
m_rootGrid.set(rootGrid);

Copy link
Contributor

Choose a reason for hiding this comment

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

this means m_rootGird wont get set to null if GetTemplateChildT fails. I think the lambda version is slightly better for this reason, look at numberbox.cpp for example. This would be okay to not fix though.

Copy link
Contributor

Choose a reason for hiding this comment

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

m_rootGrid will be null when the object is created no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that is the case. The lambda approach does seem better, however this is currently the approach we've been taking throughout this whole control. I think possibly creating a task to do a mass update might be a good idea.

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:

@ojhad
Copy link
Contributor Author

ojhad commented Mar 18, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ojhad
Copy link
Contributor Author

ojhad commented Mar 22, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

7 participants