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

Fix issue where setting IsPaneButtonVisible on NavigationView could end up in faulty rendering of pane toggle button #6780

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev/NavigationView/NavigationView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4042,6 +4042,7 @@ void NavigationView::OnPropertyChanged(const winrt::DependencyPropertyChangedEve
UpdatePaneTitleFrameworkElementParents();
UpdateBackAndCloseButtonsVisibility();
UpdatePaneToggleButtonVisibility();
UpdateTitleBarPadding();
UpdateVisualState();
}
else if (property == s_IsSettingsVisibleProperty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<StackPanel>
<StackPanel Orientation="Horizontal">
<muxcontrols:NavigationView x:Name="NavView" AutomationProperties.Name="NavView" AutomationProperties.AutomationId="NavView"
IsBackEnabled="True" Header="LeftMinimal" PaneDisplayMode="LeftMinimal" Margin="10,0">
IsBackEnabled="True" Header="LeftMinimal" PaneDisplayMode="LeftMinimal" Margin="10,0" IsPaneToggleButtonVisible="False">
<StackPanel>
<TextBlock x:Name="NavViewActiveVisualStatesResult" AutomationProperties.Name="NavViewActiveVisualStatesResult"/>
<Button x:Name="GetNavViewActiveVisualStates" AutomationProperties.Name="GetNavViewActiveVisualStates" Content="GetNavViewActiveVisualStates" Click="GetNavViewActiveVisualStates_Click"/>
Expand Down Expand Up @@ -43,6 +43,7 @@
IsChecked="{Binding IsPaneOpen, ElementName=NavViewAuto, Mode=TwoWay}"
x:Name="IsAutoPaneOpenCheckBox"
AutomationProperties.Name="IsPaneOpenCheckBox" >Toggle auto pane open</CheckBox>
<Button Content="Toggle pane open and button visible" Click="TogglePaneOpenButton_Click"/>
</StackPanel>
</StackPanel>
</local:TestPage>
15 changes: 15 additions & 0 deletions dev/NavigationView/TestUI/Common/NavigationViewMinimalPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.UI.Xaml.Controls;
using Windows.UI.Xaml;

namespace MUXControlsTestApp
Expand All @@ -16,5 +17,19 @@ private void GetNavViewActiveVisualStates_Click(object sender, RoutedEventArgs e
var visualstates = Utilities.VisualStateHelper.GetCurrentVisualStateName(NavView);
NavViewActiveVisualStatesResult.Text = string.Join(",", visualstates);
}

private void TogglePaneOpenButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (NavView.IsPaneToggleButtonVisible)
{
NavView.PaneDisplayMode = NavigationViewPaneDisplayMode.Left;
NavView.IsPaneToggleButtonVisible = false;
}
else
{
NavView.PaneDisplayMode = NavigationViewPaneDisplayMode.LeftMinimal;
NavView.IsPaneToggleButtonVisible = true;
}
}
}
}