Skip to content

Commit

Permalink
NavigationViewTemplateSettings.OpenPaneLength Update (#7341)
Browse files Browse the repository at this point in the history
* update to public

* update name to OpenPaneLength
  • Loading branch information
karkarl authored Jul 10, 2022
1 parent dffc761 commit bace2c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
20 changes: 10 additions & 10 deletions dev/Generated/NavigationViewTemplateSettings.properties.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

// DO NOT EDIT! This file was generated by CustomTasks.DependencyPropertyCodeGen
Expand All @@ -15,7 +15,7 @@ namespace winrt::Microsoft::UI::Xaml::Controls

GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_BackButtonVisibilityProperty{ nullptr };
GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_LeftPaneVisibilityProperty{ nullptr };
GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_OpenPaneWidthProperty{ nullptr };
GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_OpenPaneLengthProperty{ nullptr };
GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_OverflowButtonVisibilityProperty{ nullptr };
GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_PaneToggleButtonVisibilityProperty{ nullptr };
GlobalDependencyProperty NavigationViewTemplateSettingsProperties::s_PaneToggleButtonWidthProperty{ nullptr };
Expand Down Expand Up @@ -53,11 +53,11 @@ void NavigationViewTemplateSettingsProperties::EnsureProperties()
ValueHelper<winrt::Visibility>::BoxValueIfNecessary(winrt::Visibility::Visible),
nullptr);
}
if (!s_OpenPaneWidthProperty)
if (!s_OpenPaneLengthProperty)
{
s_OpenPaneWidthProperty =
s_OpenPaneLengthProperty =
InitializeDependencyProperty(
L"OpenPaneWidth",
L"OpenPaneLength",
winrt::name_of<double>(),
winrt::name_of<winrt::NavigationViewTemplateSettings>(),
false /* isAttached */,
Expand Down Expand Up @@ -147,7 +147,7 @@ void NavigationViewTemplateSettingsProperties::ClearProperties()
{
s_BackButtonVisibilityProperty = nullptr;
s_LeftPaneVisibilityProperty = nullptr;
s_OpenPaneWidthProperty = nullptr;
s_OpenPaneLengthProperty = nullptr;
s_OverflowButtonVisibilityProperty = nullptr;
s_PaneToggleButtonVisibilityProperty = nullptr;
s_PaneToggleButtonWidthProperty = nullptr;
Expand Down Expand Up @@ -183,17 +183,17 @@ winrt::Visibility NavigationViewTemplateSettingsProperties::LeftPaneVisibility()
return ValueHelper<winrt::Visibility>::CastOrUnbox(static_cast<NavigationViewTemplateSettings*>(this)->GetValue(s_LeftPaneVisibilityProperty));
}

void NavigationViewTemplateSettingsProperties::OpenPaneWidth(double value)
void NavigationViewTemplateSettingsProperties::OpenPaneLength(double value)
{
[[gsl::suppress(con)]]
{
static_cast<NavigationViewTemplateSettings*>(this)->SetValue(s_OpenPaneWidthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
static_cast<NavigationViewTemplateSettings*>(this)->SetValue(s_OpenPaneLengthProperty, ValueHelper<double>::BoxValueIfNecessary(value));
}
}

double NavigationViewTemplateSettingsProperties::OpenPaneWidth()
double NavigationViewTemplateSettingsProperties::OpenPaneLength()
{
return ValueHelper<double>::CastOrUnbox(static_cast<NavigationViewTemplateSettings*>(this)->GetValue(s_OpenPaneWidthProperty));
return ValueHelper<double>::CastOrUnbox(static_cast<NavigationViewTemplateSettings*>(this)->GetValue(s_OpenPaneLengthProperty));
}

void NavigationViewTemplateSettingsProperties::OverflowButtonVisibility(winrt::Visibility const& value)
Expand Down
8 changes: 4 additions & 4 deletions dev/Generated/NavigationViewTemplateSettings.properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class NavigationViewTemplateSettingsProperties
void LeftPaneVisibility(winrt::Visibility const& value);
winrt::Visibility LeftPaneVisibility();

void OpenPaneWidth(double value);
double OpenPaneWidth();
void OpenPaneLength(double value);
double OpenPaneLength();

void OverflowButtonVisibility(winrt::Visibility const& value);
winrt::Visibility OverflowButtonVisibility();
Expand All @@ -41,7 +41,7 @@ class NavigationViewTemplateSettingsProperties

static winrt::DependencyProperty BackButtonVisibilityProperty() { return s_BackButtonVisibilityProperty; }
static winrt::DependencyProperty LeftPaneVisibilityProperty() { return s_LeftPaneVisibilityProperty; }
static winrt::DependencyProperty OpenPaneWidthProperty() { return s_OpenPaneWidthProperty; }
static winrt::DependencyProperty OpenPaneLengthProperty() { return s_OpenPaneLengthProperty; }
static winrt::DependencyProperty OverflowButtonVisibilityProperty() { return s_OverflowButtonVisibilityProperty; }
static winrt::DependencyProperty PaneToggleButtonVisibilityProperty() { return s_PaneToggleButtonVisibilityProperty; }
static winrt::DependencyProperty PaneToggleButtonWidthProperty() { return s_PaneToggleButtonWidthProperty; }
Expand All @@ -52,7 +52,7 @@ class NavigationViewTemplateSettingsProperties

static GlobalDependencyProperty s_BackButtonVisibilityProperty;
static GlobalDependencyProperty s_LeftPaneVisibilityProperty;
static GlobalDependencyProperty s_OpenPaneWidthProperty;
static GlobalDependencyProperty s_OpenPaneLengthProperty;
static GlobalDependencyProperty s_OverflowButtonVisibilityProperty;
static GlobalDependencyProperty s_PaneToggleButtonVisibilityProperty;
static GlobalDependencyProperty s_PaneToggleButtonWidthProperty;
Expand Down
22 changes: 11 additions & 11 deletions dev/NavigationView/NavigationView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ void NavigationView::OnLayoutUpdated(const winrt::IInspectable& sender, const wi
void NavigationView::OnSizeChanged(winrt::IInspectable const& /*sender*/, winrt::SizeChangedEventArgs const& args)
{
const auto width = args.NewSize().Width;
UpdateOpenPaneWidth(width);
UpdateOpenPaneLength(width);
UpdateAdaptiveLayout(width);
UpdateTitleBarPadding();
UpdateBackAndCloseButtonsVisibility();
Expand All @@ -1398,14 +1398,14 @@ void NavigationView::OnItemsContainerSizeChanged(const winrt::IInspectable& send
UpdatePaneLayout();
}

void NavigationView::UpdateOpenPaneWidth(double width)
void NavigationView::UpdateOpenPaneLength(double width)
{
if (!IsTopNavigationView() && m_rootSplitView)
{
m_openPaneWidth = std::max(0.0, std::min(width, OpenPaneLength()));
m_OpenPaneLength = std::max(0.0, std::min(width, OpenPaneLength()));

const auto templateSettings = GetTemplateSettings();
templateSettings->OpenPaneWidth(m_openPaneWidth);
templateSettings->OpenPaneLength(m_OpenPaneLength);
}
}

Expand Down Expand Up @@ -4096,7 +4096,7 @@ void NavigationView::OnPropertyChanged(const winrt::DependencyPropertyChangedEve
}
else if (property == s_OpenPaneLengthProperty)
{
UpdateOpenPaneWidth(ActualWidth());
UpdateOpenPaneLength(ActualWidth());
}
}

Expand Down Expand Up @@ -4456,13 +4456,13 @@ void NavigationView::UpdatePaneToggleSize()
{
if (splitView.DisplayMode() == winrt::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() == winrt::SplitViewDisplayMode::Overlay && !IsPaneOpen()))
{
width = m_openPaneWidth;
togglePaneButtonWidth = m_openPaneWidth;
width = m_OpenPaneLength;
togglePaneButtonWidth = m_OpenPaneLength;
}
}

Expand Down Expand Up @@ -4944,11 +4944,11 @@ void NavigationView::UpdatePaneShadow()
// Ensure shadow is as wide as the pane when it is open
if (DisplayMode() == winrt::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
4 changes: 2 additions & 2 deletions dev/NavigationView/NavigationView.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class NavigationView :
void OnItemsContainerSizeChanged(const winrt::IInspectable& sender, const winrt::SizeChangedEventArgs& args);
void OnLayoutUpdated(const winrt::IInspectable& sender, const winrt::IInspectable& e);
void UpdateAdaptiveLayout(double width, bool forceSetDisplayMode = false);
void UpdateOpenPaneWidth(double width);
void UpdateOpenPaneLength(double width);
void UpdatePaneLayout();
void SetDisplayMode(const winrt::NavigationViewDisplayMode& displayMode, bool forceSetDisplayMode = false);

Expand Down Expand Up @@ -506,6 +506,6 @@ class NavigationView :

bool m_isLeftPaneTitleEmpty{ false };

double m_openPaneWidth{ 320.0 };
double m_OpenPaneLength{ 320.0 };
};

6 changes: 3 additions & 3 deletions dev/NavigationView/NavigationView.idl
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ unsealed runtimeclass NavigationViewTemplateSettings : Windows.UI.Xaml.Dependenc
static Windows.UI.Xaml.DependencyProperty PaneToggleButtonWidthProperty{ get; };
static Windows.UI.Xaml.DependencyProperty SmallerPaneToggleButtonWidthProperty{ get; };

[MUX_PREVIEW]
[MUX_PUBLIC_V2]
{
[MUX_DEFAULT_VALUE("320.0")]
Double OpenPaneWidth{ get; };
Double OpenPaneLength{ get; };

static Windows.UI.Xaml.DependencyProperty OpenPaneWidthProperty{ get; };
static Windows.UI.Xaml.DependencyProperty OpenPaneLengthProperty{ get; };
}
}

Expand Down
4 changes: 2 additions & 2 deletions dev/NavigationView/NavigationView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,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 @@ -683,7 +683,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

0 comments on commit bace2c5

Please sign in to comment.