Skip to content

Commit

Permalink
feat(NavigationView): Include Delay load Hierarchical NavViewItem ele…
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Sep 18, 2023
1 parent e9287cc commit db71402
Show file tree
Hide file tree
Showing 6 changed files with 1,165 additions and 1,084 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- MUX reference NavigationBackButton_v1.xaml, commit d3fef08fd -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down Expand Up @@ -767,6 +768,7 @@
Control.IsTemplateFocusTarget="True">
</primitives:NavigationViewItemPresenter>
<local:ItemsRepeater
x:Load="False"
Grid.Row="1"
Visibility="Collapsed"
x:Name="NavigationViewItemMenuItemsHost">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- MUX reference NavigationView_rs1_themeresources.xaml, commit 7ec5fb5 -->
<!-- MUX reference NavigationBackButton_v1.xaml, commit d3fef08fd -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down Expand Up @@ -686,11 +686,13 @@
</VisualState>
<VisualState x:Name="PointerOverChevronVisibleOpen">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPointerOver}" />
<Setter Target="ExpandCollapseChevron.(local:AnimatedIcon.State)" Value="PointerOverOn"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOverChevronVisibleClosed">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPointerOver}" />
<Setter Target="ExpandCollapseChevron.(local:AnimatedIcon.State)" Value="PointerOverOff"/>
</VisualState.Setters>
</VisualState>
Expand All @@ -701,11 +703,13 @@
</VisualState>
<VisualState x:Name="PressedChevronVisibleOpen">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPressed}" />
<Setter Target="ExpandCollapseChevron.(local:AnimatedIcon.State)" Value="PressedOn"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PressedChevronVisibleClosed">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPressed}" />
<Setter Target="ExpandCollapseChevron.(local:AnimatedIcon.State)" Value="PressedOff"/>
</VisualState.Setters>
</VisualState>
Expand Down Expand Up @@ -784,6 +788,7 @@
AutomationProperties.AccessibilityView="Raw"/>

<Grid
x:Load="False"
x:Name="ExpandCollapseChevron"
Grid.Column="3"
Visibility="Collapsed"
Expand Down Expand Up @@ -1093,11 +1098,13 @@
</VisualState>
<VisualState x:Name="PointerOverChevronVisibleOpen">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPointerOver}" />
<Setter Target="ExpandCollapseChevronIcon.(local:AnimatedIcon.State)" Value="PointerOverOn"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOverChevronVisibleClosed">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPointerOver}" />
<Setter Target="ExpandCollapseChevronIcon.(local:AnimatedIcon.State)" Value="PointerOverOff"/>
</VisualState.Setters>
</VisualState>
Expand All @@ -1108,11 +1115,13 @@
</VisualState>
<VisualState x:Name="PressedChevronVisibleOpen">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPressed}" />
<Setter Target="ExpandCollapseChevronIcon.(local:AnimatedIcon.State)" Value="PressedOn"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PressedChevronVisibleClosed">
<VisualState.Setters>
<Setter Target="ExpandCollapseChevronIcon.Foreground" Value="{ThemeResource NavigationViewItemForegroundPressed}" />
<Setter Target="ExpandCollapseChevronIcon.(local:AnimatedIcon.State)" Value="PressedOff"/>
</VisualState.Setters>
</VisualState>
Expand Down Expand Up @@ -1169,6 +1178,7 @@
Height="12"
RenderTransformOrigin="0.5, 0.5"
x:Name="ExpandCollapseChevronIcon"
Foreground="{ThemeResource NavigationViewItemForeground}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Expand Down Expand Up @@ -1419,6 +1429,7 @@
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"/>
<Grid
x:Load="False"
x:Name="ExpandCollapseChevron"
Grid.Column="3"
Visibility="Collapsed"
Expand Down Expand Up @@ -1476,4 +1487,4 @@
<Setter Property="VerticalAlignment" Value="Stretch"/>
</Style>

</ResourceDictionary>
</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
// MUX reference NavigationViewItem.h, commit fd22d7f
// MUX reference NavigationViewItem.h, commit d3fef08fd

using Microsoft.UI.Xaml.Controls.Primitives;
using Uno.Disposables;
using Windows.ApplicationModel.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;

namespace Microsoft.UI.Xaml.Controls
namespace Microsoft.UI.Xaml.Controls;

public partial class NavigationViewItem
{
public partial class NavigationViewItem
{
internal SerialDisposable EventRevoker { get; } = new SerialDisposable();

internal ItemsRepeater GetRepeater() => m_repeater;

private readonly SerialDisposable m_splitViewIsPaneOpenChangedRevoker = new SerialDisposable();
private readonly SerialDisposable m_splitViewDisplayModeChangedRevoker = new SerialDisposable();
private readonly SerialDisposable m_splitViewCompactPaneLengthChangedRevoker = new SerialDisposable();

private readonly SerialDisposable m_presenterPointerPressedRevoker = new SerialDisposable();
private readonly SerialDisposable m_presenterPointerEnteredRevoker = new SerialDisposable();
private readonly SerialDisposable m_presenterPointerMovedRevoker = new SerialDisposable();
private readonly SerialDisposable m_presenterPointerReleasedRevoker = new SerialDisposable();
private readonly SerialDisposable m_presenterPointerExitedRevoker = new SerialDisposable();
private readonly SerialDisposable m_presenterPointerCanceledRevoker = new SerialDisposable();
private readonly SerialDisposable m_presenterPointerCaptureLostRevoker = new SerialDisposable();

private readonly SerialDisposable m_repeaterElementPreparedRevoker = new SerialDisposable();
private readonly SerialDisposable m_repeaterElementClearingRevoker = new SerialDisposable();
private readonly SerialDisposable m_itemsSourceViewCollectionChangedRevoker = new SerialDisposable();

private readonly SerialDisposable m_flyoutClosingRevoker = new SerialDisposable();
private readonly SerialDisposable m_isEnabledChangedRevoker = new SerialDisposable();

private ToolTip m_toolTip = null;
private NavigationViewItemHelper<NavigationViewItem> backing_m_helper = null;
private NavigationViewItemHelper<NavigationViewItem> m_helper => backing_m_helper ??= new NavigationViewItemHelper<NavigationViewItem>(this);

private NavigationViewItemPresenter m_navigationViewItemPresenter = null;
private object m_suggestedToolTipContent = null;
private ItemsRepeater m_repeater = null;
private Grid m_flyoutContentGrid = null;
private Grid m_rootGrid = null;

private bool m_isClosedCompact = false;

private bool m_appliedTemplate = false;
private bool m_hasKeyboardFocus = false;

// Visual state tracking
private Pointer m_capturedPointer = null;
private uint m_trackedPointerId = 0;
private bool m_isPressed = false;
private bool m_isPointerOver = false;

private bool m_isRepeaterParentedToFlyout = false;
}
internal SerialDisposable EventRevoker { get; } = new();

internal ItemsRepeater GetRepeater() => m_repeater;

private readonly SerialDisposable m_splitViewIsPaneOpenChangedRevoker = new();
private readonly SerialDisposable m_splitViewDisplayModeChangedRevoker = new();
private readonly SerialDisposable m_splitViewCompactPaneLengthChangedRevoker = new();

private readonly SerialDisposable m_presenterPointerPressedRevoker = new();
private readonly SerialDisposable m_presenterPointerEnteredRevoker = new();
private readonly SerialDisposable m_presenterPointerMovedRevoker = new();
private readonly SerialDisposable m_presenterPointerReleasedRevoker = new();
private readonly SerialDisposable m_presenterPointerExitedRevoker = new();
private readonly SerialDisposable m_presenterPointerCanceledRevoker = new();
private readonly SerialDisposable m_presenterPointerCaptureLostRevoker = new();

private readonly SerialDisposable m_repeaterElementPreparedRevoker = new();
private readonly SerialDisposable m_repeaterElementClearingRevoker = new();
private readonly SerialDisposable m_itemsSourceViewCollectionChangedRevoker = new();
private readonly SerialDisposable m_menuItemsVectorChangedRevoker = new();

private readonly SerialDisposable m_flyoutClosingRevoker = new();
private readonly SerialDisposable m_isEnabledChangedRevoker = new();

private ToolTip m_toolTip;
private NavigationViewItemHelper<NavigationViewItem> backing_m_helper;
private NavigationViewItemHelper<NavigationViewItem> m_helper => backing_m_helper ??= new(this);

private NavigationViewItemPresenter m_navigationViewItemPresenter;
private object m_suggestedToolTipContent;
private ItemsRepeater m_repeater;
private Grid m_flyoutContentGrid;
private Grid m_rootGrid;

private bool m_isClosedCompact;

private bool m_appliedTemplate;
private bool m_hasKeyboardFocus;

// Visual state tracking
private Pointer m_capturedPointer;
private uint m_trackedPointerId;
private bool m_isPressed;
private bool m_isPointerOver;

private bool m_isRepeaterParentedToFlyout;
// used to bypass all Chevron visual state logic in order to keep it unloaded
private bool m_hasHadChildren;
}
Loading

0 comments on commit db71402

Please sign in to comment.