Skip to content

Commit 73dba2b

Browse files
authored
Use documented NavigationView adaptive behavior and always set titlebar (#2628)
1 parent 654fe56 commit 73dba2b

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Files/Views/Settings.xaml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@
5252
<muxc:NavigationView
5353
x:Name="SettingsPane"
5454
BackRequested="SettingsPane_BackRequested"
55+
CompactModeThresholdWidth="0"
5556
IsBackButtonVisible="Visible"
5657
IsBackEnabled="True"
5758
IsPaneOpen="True"
5859
IsPaneToggleButtonVisible="False"
5960
IsSettingsVisible="False"
6061
IsTitleBarAutoPaddingEnabled="False"
6162
OpenPaneLength="250"
62-
PaneDisplayMode="LeftCompact"
63+
PaneDisplayMode="Auto"
6364
SelectionChanged="SettingsPane_SelectionChanged">
6465

6566
<muxc:NavigationView.PaneHeader>
@@ -140,17 +141,5 @@
140141
</muxc:NavigationView.MenuItems>
141142
<Frame x:Name="SettingsContentFrame" Padding="14,30,0,0" />
142143
</muxc:NavigationView>
143-
<VisualStateManager.VisualStateGroups>
144-
<VisualStateGroup>
145-
<VisualState>
146-
<VisualState.StateTriggers>
147-
<AdaptiveTrigger MinWindowWidth="{x:Bind SettingsPane.CompactModeThresholdWidth}" />
148-
</VisualState.StateTriggers>
149-
<VisualState.Setters>
150-
<Setter Target="SettingsPane.PaneDisplayMode" Value="Left" />
151-
</VisualState.Setters>
152-
</VisualState>
153-
</VisualStateGroup>
154-
</VisualStateManager.VisualStateGroups>
155144
</Grid>
156145
</Page>

Files/Views/Settings.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Windows.UI.Core;
66
using Windows.UI.Xaml;
77
using Windows.UI.Xaml.Controls;
8+
using Windows.UI.Xaml.Navigation;
89

910
namespace Files
1011
{
@@ -15,6 +16,11 @@ public sealed partial class Settings : Page
1516
public Settings()
1617
{
1718
this.InitializeComponent();
19+
}
20+
21+
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
22+
{
23+
base.OnNavigatedTo(eventArgs);
1824

1925
var CoreTitleBar = CoreApplication.GetCurrentView().TitleBar;
2026
CoreTitleBar.ExtendViewIntoTitleBar = true;
@@ -33,6 +39,12 @@ public Settings()
3339
SettingsPane.SelectedItem = SettingsPane.MenuItems[0];
3440
}
3541

42+
protected override void OnNavigatedFrom(NavigationEventArgs eventArgs)
43+
{
44+
var currentView = SystemNavigationManager.GetForCurrentView();
45+
currentView.BackRequested -= OnBackRequested;
46+
}
47+
3648
private void OnBackRequested(object sender, BackRequestedEventArgs e)
3749
{
3850
Frame rootFrame = Window.Current.Content as Frame;

0 commit comments

Comments
 (0)