Skip to content

Commit

Permalink
feat(NavigationView): Include NavigationViewTemplateSettings.OpenPane…
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Sep 18, 2023
1 parent 17e7855 commit 4db764c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
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 NavigationBackButton_v1.xaml, commit d3fef08fd -->
<!-- MUX reference NavigationBackButton_v1.xaml, commit bace2c5 -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down Expand Up @@ -402,7 +402,7 @@
DisplayMode="Inline"
IsPaneOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPaneOpen, Mode=TwoWay}"
IsTabStop="False"
OpenPaneLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneWidth}"
OpenPaneLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneLength}"
PaneBackground="{ThemeResource NavigationViewDefaultPaneBackground}"
Grid.Row="1"
contract7Present:CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource RightCornerRadiusFilterConverter}}">
Expand Down Expand Up @@ -616,7 +616,7 @@
<Grid
x:Name="ShadowCaster"
Grid.RowSpan="2"
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneWidth}"
Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneLength}"
HorizontalAlignment="Left">
<Grid.RenderTransform>
<CompositeTransform x:Name="ShadowCasterTransform" />
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI.FluentTheme.v2/themeresources_v2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17979,7 +17979,7 @@
<Border x:Name="TopNavContentOverlayAreaGrid" Child="{TemplateBinding ContentOverlay}" />
</StackPanel>
<!-- Displaymode (compact/minimal/normal) left -->
<SplitView x:Name="RootSplitView" Background="{TemplateBinding Background}" BorderBrush="{ThemeResource NavigationViewItemSeparatorForeground}" BorderThickness="{ThemeResource NavigationViewBorderThickness}" CompactPaneLength="{TemplateBinding CompactPaneLength}" DisplayMode="Inline" IsPaneOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPaneOpen, Mode=TwoWay}" IsTabStop="False" OpenPaneLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneWidth}" PaneBackground="{ThemeResource NavigationViewDefaultPaneBackground}" Grid.Row="1" contract7Present:CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource RightCornerRadiusFilterConverter}}">
<SplitView x:Name="RootSplitView" Background="{TemplateBinding Background}" BorderBrush="{ThemeResource NavigationViewItemSeparatorForeground}" BorderThickness="{ThemeResource NavigationViewBorderThickness}" CompactPaneLength="{TemplateBinding CompactPaneLength}" DisplayMode="Inline" IsPaneOpen="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsPaneOpen, Mode=TwoWay}" IsTabStop="False" OpenPaneLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneLength}" PaneBackground="{ThemeResource NavigationViewDefaultPaneBackground}" Grid.Row="1" contract7Present:CornerRadius="{Binding Source={ThemeResource OverlayCornerRadius}, Converter={StaticResource RightCornerRadiusFilterConverter}}">
<SplitView.Pane>
<Grid x:Name="PaneContentGrid" BorderBrush="{ThemeResource NavigationViewItemSeparatorForeground}" HorizontalAlignment="Left" Margin="{ThemeResource NavigationViewPaneContentGridMargin}" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.LeftPaneVisibility}">
<Grid.RowDefinitions>
Expand Down Expand Up @@ -18096,7 +18096,7 @@
</Grid>
</SplitView.Content>
</SplitView>
<Grid x:Name="ShadowCaster" Grid.RowSpan="2" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneWidth}" HorizontalAlignment="Left">
<Grid x:Name="ShadowCaster" Grid.RowSpan="2" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.OpenPaneLength}" HorizontalAlignment="Left">
<Grid.RenderTransform>
<CompositeTransform x:Name="ShadowCasterTransform" />
</Grid.RenderTransform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1546,21 +1546,21 @@ private void OnLayoutUpdated(object sender, object e)
private void OnSizeChanged(object sender, SizeChangedEventArgs args)
{
var width = args.NewSize.Width;
UpdateOpenPaneWidth(width);
UpdateOpenPaneLength(width);
UpdateAdaptiveLayout(width);
UpdateTitleBarPadding();
UpdateBackAndCloseButtonsVisibility();
UpdatePaneLayout();
}

private void UpdateOpenPaneWidth(double width)
private void UpdateOpenPaneLength(double width)
{
if (!IsTopNavigationView() && m_rootSplitView != null)
{
m_openPaneWidth = Math.Max(0.0, Math.Min(width, OpenPaneLength));
m_openPaneLength = Math.Max(0.0, Math.Min(width, OpenPaneLength));

var templateSettings = GetTemplateSettings();
templateSettings.OpenPaneWidth = m_openPaneWidth;
templateSettings.OpenPaneLength = m_openPaneLength;
}
}

Expand Down Expand Up @@ -4392,7 +4392,7 @@ private void OnPropertyChanged(DependencyPropertyChangedEventArgs args)
}
else if (property == OpenPaneLengthProperty)
{
UpdateOpenPaneWidth(ActualWidth);
UpdateOpenPaneLength(ActualWidth);
}
}

Expand Down Expand Up @@ -4771,13 +4771,13 @@ private void UpdatePaneToggleSize()
{
if (splitView.DisplayMode == SplitViewDisplayMode.Overlay && IsPaneOpen)
{
width = m_openPaneWidth;
togglePaneButtonWidth = m_openPaneWidth - ((ShouldShowBackButton() || ShouldShowCloseButton()) ? c_backButtonWidth : 0);
width = m_openPaneLength;
togglePaneButtonWidth = m_openPaneLength - ((ShouldShowBackButton() || ShouldShowCloseButton()) ? c_backButtonWidth : 0);
}
else if (!(splitView.DisplayMode == SplitViewDisplayMode.Overlay && !IsPaneOpen))
{
width = m_openPaneWidth;
togglePaneButtonWidth = m_openPaneWidth;
width = m_openPaneLength;
togglePaneButtonWidth = m_openPaneLength;
}
}

Expand Down Expand Up @@ -5285,11 +5285,11 @@ private void UpdatePaneShadow()
// Ensure shadow is as wide as the pane when it is open
if (DisplayMode == NavigationViewDisplayMode.Compact)
{
shadowReceiver.Width = m_openPaneWidth;
shadowReceiver.Width = m_openPaneLength;
}
else
{
shadowReceiver.Width = m_openPaneWidth - shadowReceiverMargin.Right;
shadowReceiver.Width = m_openPaneLength - shadowReceiverMargin.Right;
}
shadowReceiver.Margin(shadowReceiverMargin);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// MUX Reference NavigationViewTemplateSettings.properties.cpp, commit 991c831
// MUX Reference NavigationViewTemplateSettings.properties.cpp, commit bace2c5

using Windows.UI.Xaml;

Expand Down Expand Up @@ -52,17 +52,17 @@ public Visibility LeftPaneVisibility
/// <summary>
/// Gets the width of open pane.
/// </summary>
public double OpenPaneWidth
public double OpenPaneLength
{
get => (double)GetValue(OpenPaneWidthProperty);
set => SetValue(OpenPaneWidthProperty, value);
get => (double)GetValue(OpenPaneLengthProperty);
set => SetValue(OpenPaneLengthProperty, value);
}

/// <summary>
/// Identifies the OpenPaneWidth dependency property.
/// Identifies the OpenPaneLength dependency property.
/// </summary>
public static DependencyProperty OpenPaneWidthProperty { get; } =
DependencyProperty.Register(nameof(OpenPaneWidth), typeof(double), typeof(NavigationViewTemplateSettings), new FrameworkPropertyMetadata(320.0));
public static DependencyProperty OpenPaneLengthProperty { get; } =
DependencyProperty.Register(nameof(OpenPaneLength), typeof(double), typeof(NavigationViewTemplateSettings), new FrameworkPropertyMetadata(320.0));

/// <summary>
/// Gets the visibility of the overflow button.
Expand Down

0 comments on commit 4db764c

Please sign in to comment.