浏览代码

Merge branch 'master' into colorpicker-updates-7

robloo 2 年之前
父节点
当前提交
a485ddca9d

+ 14 - 9
src/Avalonia.Controls/Chrome/CaptionButtons.cs

@@ -8,13 +8,18 @@ namespace Avalonia.Controls.Chrome
     /// <summary>
     /// <summary>
     /// Draws window minimize / maximize / close buttons in a <see cref="TitleBar"/> when managed client decorations are enabled.
     /// Draws window minimize / maximize / close buttons in a <see cref="TitleBar"/> when managed client decorations are enabled.
     /// </summary>
     /// </summary>
-    [TemplatePart("PART_CloseButton",      typeof(Button))]
-    [TemplatePart("PART_RestoreButton",    typeof(Button))]
-    [TemplatePart("PART_MinimiseButton",   typeof(Button))]
-    [TemplatePart("PART_FullScreenButton", typeof(Button))]
+    [TemplatePart(PART_CloseButton,      typeof(Button))]
+    [TemplatePart(PART_RestoreButton,    typeof(Button))]
+    [TemplatePart(PART_MinimizeButton,   typeof(Button))]
+    [TemplatePart(PART_FullScreenButton, typeof(Button))]
     [PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")]
     [PseudoClasses(":minimized", ":normal", ":maximized", ":fullscreen")]
     public class CaptionButtons : TemplatedControl
     public class CaptionButtons : TemplatedControl
     {
     {
+        private const string PART_CloseButton = "PART_CloseButton";
+        private const string PART_RestoreButton = "PART_RestoreButton";
+        private const string PART_MinimizeButton = "PART_MinimizeButton";
+        private const string PART_FullScreenButton = "PART_FullScreenButton";
+
         private Button? _restoreButton;
         private Button? _restoreButton;
         private IDisposable? _disposables;
         private IDisposable? _disposables;
 
 
@@ -95,14 +100,14 @@ namespace Avalonia.Controls.Chrome
         {
         {
             base.OnApplyTemplate(e);
             base.OnApplyTemplate(e);
 
 
-            var closeButton = e.NameScope.Get<Button>("PART_CloseButton");
-            var restoreButton = e.NameScope.Get<Button>("PART_RestoreButton");
-            var minimiseButton = e.NameScope.Get<Button>("PART_MinimiseButton");
-            var fullScreenButton = e.NameScope.Get<Button>("PART_FullScreenButton");
+            var closeButton = e.NameScope.Get<Button>(PART_CloseButton);
+            var restoreButton = e.NameScope.Get<Button>(PART_RestoreButton);
+            var minimizeButton = e.NameScope.Get<Button>(PART_MinimizeButton);
+            var fullScreenButton = e.NameScope.Get<Button>(PART_FullScreenButton);
 
 
             closeButton.Click += (sender, e) => OnClose();
             closeButton.Click += (sender, e) => OnClose();
             restoreButton.Click += (sender, e) => OnRestore();
             restoreButton.Click += (sender, e) => OnRestore();
-            minimiseButton.Click += (sender, e) => OnMinimize();
+            minimizeButton.Click += (sender, e) => OnMinimize();
             fullScreenButton.Click += (sender, e) => OnToggleFullScreen();
             fullScreenButton.Click += (sender, e) => OnToggleFullScreen();
 
 
             restoreButton.IsEnabled = HostWindow?.CanResize ?? true;
             restoreButton.IsEnabled = HostWindow?.CanResize ?? true;

+ 4 - 4
src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml

@@ -47,9 +47,9 @@
                     Data="M2048 2048v-819h-205v469l-1493 -1493h469v-205h-819v819h205v-469l1493 1493h-469v205h819z" />
                     Data="M2048 2048v-819h-205v469l-1493 -1493h469v-205h-819v819h205v-469l1493 1493h-469v205h819z" />
             </Viewbox>
             </Viewbox>
           </Button>
           </Button>
-          <Button x:Name="PART_MinimiseButton"
+          <Button x:Name="PART_MinimizeButton"
                   Theme="{StaticResource FluentCaptionButton}"
                   Theme="{StaticResource FluentCaptionButton}"
-                  AutomationProperties.Name="Minimise">
+                  AutomationProperties.Name="Minimize">
             <Viewbox Width="11" Margin="2">
             <Viewbox Width="11" Margin="2">
               <Path Stretch="UniformToFill"
               <Path Stretch="UniformToFill"
                     Fill="{TemplateBinding Foreground}"
                     Fill="{TemplateBinding Foreground}"
@@ -58,7 +58,7 @@
           </Button>
           </Button>
           <Button x:Name="PART_RestoreButton"
           <Button x:Name="PART_RestoreButton"
                   Theme="{StaticResource FluentCaptionButton}"
                   Theme="{StaticResource FluentCaptionButton}"
-                  AutomationProperties.Name="Maximise">
+                  AutomationProperties.Name="Maximize">
             <Viewbox Width="11" Margin="2">
             <Viewbox Width="11" Margin="2">
               <Viewbox.RenderTransform>
               <Viewbox.RenderTransform>
                 <RotateTransform Angle="-90" />
                 <RotateTransform Angle="-90" />
@@ -93,7 +93,7 @@
     <Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
     <Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
       <Setter Property="IsVisible" Value="False" />
       <Setter Property="IsVisible" Value="False" />
     </Style>
     </Style>
-    <Style Selector="^:fullscreen /template/ Button#PART_MinimiseButton">
+    <Style Selector="^:fullscreen /template/ Button#PART_MinimizeButton">
       <Setter Property="IsVisible" Value="False" />
       <Setter Property="IsVisible" Value="False" />
     </Style>
     </Style>
     <Style Selector="^ /template/ Button#PART_RestoreButton:disabled">
     <Style Selector="^ /template/ Button#PART_RestoreButton:disabled">

+ 4 - 4
src/Avalonia.Themes.Simple/Controls/CaptionButtons.xaml

@@ -53,9 +53,9 @@
                     Stretch="UniformToFill" />
                     Stretch="UniformToFill" />
             </Viewbox>
             </Viewbox>
           </Button>
           </Button>
-          <Button x:Name="PART_MinimiseButton"
+          <Button x:Name="PART_MinimizeButton"
                   Theme="{StaticResource SimpleCaptionButton}"
                   Theme="{StaticResource SimpleCaptionButton}"
-                  AutomationProperties.Name="Minimise">
+                  AutomationProperties.Name="Minimize">
             <Viewbox Width="11"
             <Viewbox Width="11"
                      Margin="2">
                      Margin="2">
               <Path Data="M2048 1229v-205h-2048v205h2048z"
               <Path Data="M2048 1229v-205h-2048v205h2048z"
@@ -65,7 +65,7 @@
           </Button>
           </Button>
           <Button x:Name="PART_RestoreButton"
           <Button x:Name="PART_RestoreButton"
                   Theme="{StaticResource SimpleCaptionButton}"
                   Theme="{StaticResource SimpleCaptionButton}"
-                  AutomationProperties.Name="Maximise">
+                  AutomationProperties.Name="Maximize">
             <Viewbox Width="11"
             <Viewbox Width="11"
                      Margin="2">
                      Margin="2">
               <Viewbox.RenderTransform>
               <Viewbox.RenderTransform>
@@ -102,7 +102,7 @@
     <Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
     <Style Selector="^:fullscreen /template/ Button#PART_RestoreButton">
       <Setter Property="IsVisible" Value="False" />
       <Setter Property="IsVisible" Value="False" />
     </Style>
     </Style>
-    <Style Selector="^:fullscreen /template/ Button#PART_MinimiseButton">
+    <Style Selector="^:fullscreen /template/ Button#PART_MinimizeButton">
       <Setter Property="IsVisible" Value="False" />
       <Setter Property="IsVisible" Value="False" />
     </Style>
     </Style>
     <Style Selector="^ /template/ Button#PART_RestoreButton:disabled">
     <Style Selector="^ /template/ Button#PART_RestoreButton:disabled">

+ 1 - 1
tests/Avalonia.IntegrationTests.Appium/WindowTests.cs

@@ -263,7 +263,7 @@ namespace Avalonia.IntegrationTests.Appium
                 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                 {
                 {
                     maximizeButton = extendClientArea ?
                     maximizeButton = extendClientArea ?
-                        secondaryWindow.FindElementByXPath("//Button[@Name='Maximise']") :
+                        secondaryWindow.FindElementByXPath("//Button[@Name='Maximize']") :
                         secondaryWindow.FindElementByXPath("//TitleBar/Button[2]");
                         secondaryWindow.FindElementByXPath("//TitleBar/Button[2]");
                 }
                 }
                 else
                 else