diff --git a/src/Avalonia.Controls/Chrome/CaptionButtons.cs b/src/Avalonia.Controls/Chrome/CaptionButtons.cs index 90dd14c703..237fa87968 100644 --- a/src/Avalonia.Controls/Chrome/CaptionButtons.cs +++ b/src/Avalonia.Controls/Chrome/CaptionButtons.cs @@ -8,13 +8,18 @@ namespace Avalonia.Controls.Chrome /// /// Draws window minimize / maximize / close buttons in a when managed client decorations are enabled. /// - [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")] 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 IDisposable? _disposables; @@ -95,14 +100,14 @@ namespace Avalonia.Controls.Chrome { base.OnApplyTemplate(e); - var closeButton = e.NameScope.Get -