From f84bb753e9d1b3603c67f449087e0859fd4e7d30 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Thu, 13 Mar 2025 16:44:16 -0600 Subject: [PATCH] Revert custom window border on Windows --- Source/LibationAvalonia/App.axaml | 62 ++-------------- .../LibationAvalonia/Dialogs/DialogWindow.cs | 74 ++----------------- .../Dialogs/MessageBoxWindow.axaml | 4 +- .../Dialogs/ThemePickerDialog.axaml.cs | 2 +- .../Themes/ChardonnayTheme.cs | 1 - 5 files changed, 15 insertions(+), 128 deletions(-) diff --git a/Source/LibationAvalonia/App.axaml b/Source/LibationAvalonia/App.axaml index 9edde65f..918ba314 100644 --- a/Source/LibationAvalonia/App.axaml +++ b/Source/LibationAvalonia/App.axaml @@ -89,61 +89,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/Source/LibationAvalonia/Dialogs/DialogWindow.cs b/Source/LibationAvalonia/Dialogs/DialogWindow.cs index 776c9cab..092aa3a9 100644 --- a/Source/LibationAvalonia/Dialogs/DialogWindow.cs +++ b/Source/LibationAvalonia/Dialogs/DialogWindow.cs @@ -12,98 +12,34 @@ namespace LibationAvalonia.Dialogs { protected bool CancelOnEscape { get; set; } = true; protected bool SaveOnEnter { get; set; } = true; - public bool SaveAndRestorePosition { get; set; } = true; + public bool SaveAndRestorePosition { get; set; } public Control ControlToFocusOnShow { get; set; } protected override Type StyleKeyOverride => typeof(DialogWindow); - public static readonly StyledProperty UseCustomTitleBarProperty = - AvaloniaProperty.Register(nameof(UseCustomTitleBar)); - - public bool UseCustomTitleBar - { - get { return GetValue(UseCustomTitleBarProperty); } - set { SetValue(UseCustomTitleBarProperty, value); } - } - - public DialogWindow() + public DialogWindow(bool saveAndRestorePosition = true) { + SaveAndRestorePosition = saveAndRestorePosition; KeyDown += DialogWindow_KeyDown; Initialized += DialogWindow_Initialized; Opened += DialogWindow_Opened; Closing += DialogWindow_Closing; - UseCustomTitleBar = Configuration.IsWindows; - if (Design.IsDesignMode) RequestedThemeVariant = ThemeVariant.Dark; } - private bool fixedMinHeight = false; - private bool fixedMaxHeight = false; - private bool fixedHeight = false; - - protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) - { - const int customTitleBarHeight = 30; - if (UseCustomTitleBar) - { - if (change.Property == MinHeightProperty && !fixedMinHeight) - { - fixedMinHeight = true; - MinHeight += customTitleBarHeight; - fixedMinHeight = false; - } - if (change.Property == MaxHeightProperty && !fixedMaxHeight) - { - fixedMaxHeight = true; - MaxHeight += customTitleBarHeight; - fixedMaxHeight = false; - } - if (change.Property == HeightProperty && !fixedHeight) - { - fixedHeight = true; - Height += customTitleBarHeight; - fixedHeight = false; - } - } - base.OnPropertyChanged(change); - } - - public DialogWindow(bool saveAndRestorePosition) : this() - { - SaveAndRestorePosition = saveAndRestorePosition; - } - protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - if (!UseCustomTitleBar) - return; - - var closeButton = e.NameScope.Find