1
1
// Copyright (c) Files Community
2
2
// Licensed under the MIT License.
3
3
4
- using Windows . Graphics ;
5
4
using Files . App . ViewModels . Properties ;
6
- using Microsoft . UI ;
5
+ using Microsoft . UI . Input ;
7
6
using Microsoft . UI . Windowing ;
8
7
using Microsoft . UI . Xaml ;
9
- using Microsoft . UI . Xaml . Controls ;
10
8
using Microsoft . UI . Xaml . Input ;
11
9
using Microsoft . UI . Xaml . Navigation ;
10
+ using Windows . Graphics ;
12
11
using Windows . System ;
13
- using Windows . UI ;
14
- using Microsoft . UI . Input ;
15
12
16
13
namespace Files . App . Views . Properties
17
14
{
@@ -33,7 +30,7 @@ public MainPropertiesPage()
33
30
FlowDirection = FlowDirection . RightToLeft ;
34
31
}
35
32
36
-
33
+
37
34
// Navigates to specified properties page
38
35
public bool TryNavigateToPage ( PropertiesNavigationViewItemType pageType )
39
36
{
@@ -62,7 +59,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
62
59
Window . Closed += Window_Closed ;
63
60
64
61
AppThemeModeService . ApplyResources ( ) ;
65
- UpdatePageLayout ( ) ;
62
+ UpdatePageLayout ( this . Width ) ;
66
63
Window . RaiseSetTitleBarDragRegion ( SetTitleBarDragRegion ) ;
67
64
Window . AppWindow . Changed += AppWindow_Changed ;
68
65
}
@@ -74,24 +71,23 @@ private int SetTitleBarDragRegion(InputNonClientPointerSource source, SizeInt32
74
71
}
75
72
76
73
private void Page_SizeChanged ( object sender , SizeChangedEventArgs e )
77
- => UpdatePageLayout ( ) ;
74
+ => UpdatePageLayout ( e . NewSize . Width ) ;
78
75
79
76
private void Page_KeyDown ( object sender , KeyRoutedEventArgs e )
80
77
{
81
78
if ( e . Key . Equals ( VirtualKey . Escape ) )
82
79
Window . Close ( ) ;
83
80
}
84
81
85
- private void UpdatePageLayout ( )
82
+ private void UpdatePageLayout ( double pageWidth )
86
83
{
87
- // NavigationView Pane Mode
88
- MainPropertiesWindowNavigationView . PaneDisplayMode =
89
- ActualWidth <= 600
90
- ? NavigationViewPaneDisplayMode . LeftCompact
91
- : NavigationViewPaneDisplayMode . Left ;
84
+ if ( pageWidth < 600 )
85
+ VisualStateManager . GoToState ( this , "Narrow" , true ) ;
86
+ else
87
+ VisualStateManager . GoToState ( this , "Wide" , true ) ;
92
88
93
89
// Collapse NavigationViewItem Content text
94
- if ( ActualWidth <= 600 )
90
+ if ( ActualWidth < 600 )
95
91
foreach ( var item in MainPropertiesViewModel . NavigationViewItems ) item . IsCompact = true ;
96
92
else
97
93
foreach ( var item in MainPropertiesViewModel . NavigationViewItems ) item . IsCompact = false ;
0 commit comments