@@ -20,6 +20,7 @@ public sealed partial class Properties : Page
2020 private static AppWindowTitleBar _TitleBar ;
2121
2222 public AppWindow propWindow ;
23+
2324 public ItemPropertiesViewModel ItemProperties { get ; } = new ItemPropertiesViewModel ( ) ;
2425
2526 public Properties ( )
@@ -38,13 +39,16 @@ public Properties()
3839
3940 private async void Properties_Loaded ( object sender , RoutedEventArgs e )
4041 {
41- // Collect AppWindow-specific info
42- propWindow = Interaction . AppWindows [ UIContext ] ;
43- // Set properties window titleBar style
44- _TitleBar = propWindow . TitleBar ;
45- _TitleBar . ButtonBackgroundColor = Colors . Transparent ;
46- _TitleBar . ButtonInactiveBackgroundColor = Colors . Transparent ;
47- App . AppSettings . UpdateThemeElements . Execute ( null ) ;
42+ if ( ApiInformation . IsApiContractPresent ( "Windows.Foundation.UniversalApiContract" , 8 ) )
43+ {
44+ // Collect AppWindow-specific info
45+ propWindow = Interaction . AppWindows [ UIContext ] ;
46+ // Set properties window titleBar style
47+ _TitleBar = propWindow . TitleBar ;
48+ _TitleBar . ButtonBackgroundColor = Colors . Transparent ;
49+ _TitleBar . ButtonInactiveBackgroundColor = Colors . Transparent ;
50+ App . AppSettings . UpdateThemeElements . Execute ( null ) ;
51+ }
4852
4953 if ( App . CurrentInstance . ContentPage . IsItemSelected )
5054 {
@@ -123,22 +127,25 @@ private async void Properties_Loaded(object sender, RoutedEventArgs e)
123127 private void AppSettings_ThemeModeChanged ( object sender , EventArgs e )
124128 {
125129 RequestedTheme = ThemeHelper . RootTheme ;
126- switch ( ThemeHelper . RootTheme )
130+ if ( ApiInformation . IsApiContractPresent ( "Windows.Foundation.UniversalApiContract" , 8 ) )
127131 {
128- case ElementTheme . Default :
129- _TitleBar . ButtonHoverBackgroundColor = ( Color ) Application . Current . Resources [ "SystemBaseLowColor" ] ;
130- _TitleBar . ButtonForegroundColor = ( Color ) Application . Current . Resources [ "SystemBaseHighColor" ] ;
131- break ;
132-
133- case ElementTheme . Light :
134- _TitleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 51 , 0 , 0 , 0 ) ;
135- _TitleBar . ButtonForegroundColor = Colors . Black ;
136- break ;
137-
138- case ElementTheme . Dark :
139- _TitleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 51 , 255 , 255 , 255 ) ;
140- _TitleBar . ButtonForegroundColor = Colors . White ;
141- break ;
132+ switch ( ThemeHelper . RootTheme )
133+ {
134+ case ElementTheme . Default :
135+ _TitleBar . ButtonHoverBackgroundColor = ( Color ) Application . Current . Resources [ "SystemBaseLowColor" ] ;
136+ _TitleBar . ButtonForegroundColor = ( Color ) Application . Current . Resources [ "SystemBaseHighColor" ] ;
137+ break ;
138+
139+ case ElementTheme . Light :
140+ _TitleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 51 , 0 , 0 , 0 ) ;
141+ _TitleBar . ButtonForegroundColor = Colors . Black ;
142+ break ;
143+
144+ case ElementTheme . Dark :
145+ _TitleBar . ButtonHoverBackgroundColor = Color . FromArgb ( 51 , 255 , 255 , 255 ) ;
146+ _TitleBar . ButtonForegroundColor = Colors . White ;
147+ break ;
148+ }
142149 }
143150 }
144151
@@ -149,6 +156,10 @@ private async void Button_Click(object sender, RoutedEventArgs e)
149156 {
150157 await propWindow . CloseAsync ( ) ;
151158 }
159+ else
160+ {
161+ App . PropertiesDialogDisplay . Hide ( ) ;
162+ }
152163 }
153164 }
154165
0 commit comments