11// Copyright (c) Files Community
22// Licensed under the MIT License.
33
4- using Windows . Graphics ;
54using Files . App . ViewModels . Properties ;
6- using Microsoft . UI ;
5+ using Microsoft . UI . Input ;
76using Microsoft . UI . Windowing ;
87using Microsoft . UI . Xaml ;
9- using Microsoft . UI . Xaml . Controls ;
108using Microsoft . UI . Xaml . Input ;
119using Microsoft . UI . Xaml . Navigation ;
10+ using Windows . Graphics ;
1211using Windows . System ;
13- using Windows . UI ;
14- using Microsoft . UI . Input ;
1512
1613namespace Files . App . Views . Properties
1714{
@@ -33,7 +30,7 @@ public MainPropertiesPage()
3330 FlowDirection = FlowDirection . RightToLeft ;
3431 }
3532
36-
33+
3734 // Navigates to specified properties page
3835 public bool TryNavigateToPage ( PropertiesNavigationViewItemType pageType )
3936 {
@@ -62,7 +59,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
6259 Window . Closed += Window_Closed ;
6360
6461 AppThemeModeService . ApplyResources ( ) ;
65- UpdatePageLayout ( ) ;
62+ UpdatePageLayout ( this . Width ) ;
6663 Window . RaiseSetTitleBarDragRegion ( SetTitleBarDragRegion ) ;
6764 Window . AppWindow . Changed += AppWindow_Changed ;
6865 }
@@ -74,24 +71,23 @@ private int SetTitleBarDragRegion(InputNonClientPointerSource source, SizeInt32
7471 }
7572
7673 private void Page_SizeChanged ( object sender , SizeChangedEventArgs e )
77- => UpdatePageLayout ( ) ;
74+ => UpdatePageLayout ( e . NewSize . Width ) ;
7875
7976 private void Page_KeyDown ( object sender , KeyRoutedEventArgs e )
8077 {
8178 if ( e . Key . Equals ( VirtualKey . Escape ) )
8279 Window . Close ( ) ;
8380 }
8481
85- private void UpdatePageLayout ( )
82+ private void UpdatePageLayout ( double pageWidth )
8683 {
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 ) ;
9288
9389 // Collapse NavigationViewItem Content text
94- if ( ActualWidth <= 600 )
90+ if ( ActualWidth < 600 )
9591 foreach ( var item in MainPropertiesViewModel . NavigationViewItems ) item . IsCompact = true ;
9692 else
9793 foreach ( var item in MainPropertiesViewModel . NavigationViewItems ) item . IsCompact = false ;
0 commit comments