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