src/controls/dev/NavigationView/docs/rendering.md
This document talks about the UI of the NavigationView, and how it is achieved.
Since the rendering is different based on the displaymode, those will be looked at independently.
The NavigationView supports using a MenuItemsSource and using an ItemTemplate.
If the provided MenuItems are NavigationViewItems, and there is no ItemTemplate,the NavigationViewItems will be used as is. In case of an ItemTemplate, the NavigationViewItem acts based on the provided template. If the template returns a NavigationViewItem, the template will be used without any wrapper. If the template does not return a NavigationViewItem (e.g. a Button), the returned items will be wrapped inside a NavigationViewItem.
In the next three sections, the template parts of the NavigationView will be explained. The first section talks about items that are used regardless of the displaymode, the second section is for items only needed in displaymode left, while the third section is for displaymode top.
Note that the settings item will be rendered as an element in the FooterMenu items list.
These are the necessary control templates used for both displaymodes and how they are used in code behind.
RootGrid: Template root, used for keyboard navigationPaneToggleButtonGrid: Not usedTogglePaneTopPadding: Referenced to adjust paddingButtonHolderGrid: Not usedNavigationViewBackButton: Allows the BackRequested eventNavigationViewBackButtonToolTip: Localization of back button ToolTipNavigationViewCloseButton: Close button functionalityNavigationViewCloseButtonToolTip: Localization of close button ToolTipTogglePaneButton: Used for close/open pane functionalityPaneTitleTextBlock: Pane title binding and renderingPaneTitleHolder: Holds pane title presenterPaneTitlePresenter: Renders pane titleWhen switching between top and left displaymode, the NavigationView "moves" certain items such as the PaneHeader and the AutoSuggestBox, since UI items can only be added the VisualTree once, and we need them to be present in the area that is currently visible.
For left mode, the following control template parts are used:
RootSplitView: Renders the content and left panePaneContentGrid: Used for layouting of left pane, also needed for the animationItemsContainerRow: Used for sizing of menu items/footer itemsContentPaneTopPadding: Used for height adjustmentsPaneHeaderContentBorderRow: Referenced for sizing adjustmentsPaneHeaderCloseButtonColumn: Used for CompactPaneLength adjusting of pane close buttonsPaneHeaderToggleButtonColumn: Used for CompactPaneLength adjusting of pane toggle buttonsPaneHeaderContentBorder: Manual sizing for pane headerAutoSuggestArea: Not referencedPaneAutoSuggestBoxPresenter: Used to check if there is content in autosuggest areaPaneAutoSuggestButton: Used to open pane when button gets invokedPaneCustomContentBorder: Used for pane header renderingItemsContainerGrid: Used for size calculations of menu and footer items viewsMenuItemsScrollViewer: Used to limit sizing of menu items hostMenuItemsHost: Used for rendering of the NavigationViewItemsVisualItemsSeparator: Referenced to dynamically show/hide the separator when neededFooterContentBorder: Used for rendering of pane footerFooterMenuItemsHost: Renders the footer menu itemsContentGrid: Shadow handling and focus behaviorContentTopPadding: Not referencedContentLeftPadding: Used for padding of the contentHeaderContent: Not referencedIn DisplayMode left, the SplitView is used to show/hide the pane based on the displaymode and the width of the NavigationView's width.
In PaneDisplayMode Auto, the pane gets hidden based on its width.
For displaymode Top the following parts are used:
TopNavArea: Not referencedTopNavLeftPadding: Not referencedTopNavGrid: Used for down level supportBackButtonPlaceholderOnTopNav: Not referencedPaneHeaderOnTopPane: Used for rendering of headerPaneTitleOnTopPane: Used for rendering of pane titleTopNavMenuItemsHost: Renders the NavigationViewItems in top modeTopNavOverflowButton: Opens an overflow menu when there is not enough space to show all itemsTopNavMenuItemsOverflowHost: Renders the items in the overflow flyoutPaneCustomContentOnTopPane: Renders the custom pane contentTopPaneAutoSuggestArea: Takes up space for the search boxTopPaneAutoSuggestBoxPresenter: Renders the AutoSuggestBoxTopFooterMenuItemsHost: Renders the footer menu itemsPaneFooterOnTopPane: Shows the panefooterTopNavContentOverlayAreaGrid: Used for content overlays