瀏覽代碼

add a prefer managed chrome to demo page

Dan Walmsley 5 年之前
父節點
當前提交
2cc40e3c6a

+ 1 - 0
samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml

@@ -9,6 +9,7 @@
     <CheckBox Content="Titlebar" IsChecked="{Binding SystemTitleBarEnabled}" />
     <CheckBox Content="System Chrome Buttons" IsChecked="{Binding SystemChromeButtonsEnabled}" />
     <CheckBox Content="Managed Chrome Buttons" IsChecked="{Binding ManagedChromeButtonsEnabled}" />
+    <CheckBox Content="Prefer System Chrome Buttons" IsChecked="{Binding PreferSystemChromeButtonsEnabled}" />
     <Slider Minimum="-1" Maximum="200" Value="{Binding TitleBarHeight}" />
     <ComboBox x:Name="TransparencyLevels" SelectedIndex="{Binding TransparencyLevel}">
       <ComboBoxItem>None</ComboBoxItem>

+ 13 - 1
samples/ControlCatalog/ViewModels/MainWindowViewModel.cs

@@ -65,7 +65,7 @@ namespace ControlCatalog.ViewModels
                 WindowState.FullScreen,
             };
 
-            this.WhenAnyValue(x => x.SystemChromeButtonsEnabled, x=>x.ManagedChromeButtonsEnabled, x => x.SystemTitleBarEnabled)
+            this.WhenAnyValue(x => x.SystemChromeButtonsEnabled, x=>x.ManagedChromeButtonsEnabled, x => x.SystemTitleBarEnabled, x=>x.PreferSystemChromeButtonsEnabled)
                 .Subscribe(x =>
                 {
                     var hints = ExtendClientAreaChromeHints.NoChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
@@ -85,6 +85,11 @@ namespace ControlCatalog.ViewModels
                         hints |= ExtendClientAreaChromeHints.SystemTitleBar;
                     }
 
+                    if(x.Item4)
+                    {
+                        hints |= ExtendClientAreaChromeHints.PreferSystemChromeButtons;
+                    }
+
                     ChromeHints = hints;
                 });
 
@@ -142,6 +147,13 @@ namespace ControlCatalog.ViewModels
             set { this.RaiseAndSetIfChanged(ref _managedChromeButtonsEnabled, value); }
         }
 
+        private bool _preferSystemChromeButtonsEnabled;
+
+        public bool PreferSystemChromeButtonsEnabled
+        {
+            get { return _preferSystemChromeButtonsEnabled; }
+            set { this.RaiseAndSetIfChanged(ref _preferSystemChromeButtonsEnabled, value); }
+        }
 
         private double _titleBarHeight;