From 44d1d63349c50126f7458e4f8aab020510a828bf Mon Sep 17 00:00:00 2001 From: Meik Date: Thu, 5 Mar 2026 12:52:33 +0100 Subject: [PATCH] Respect isDraggable by toggling WindowChrome caption drag --- MainWindow.xaml.cs | 18 ++++++++++++++---- libs/configHelper.cs | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index a257a87..1401f6f 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -67,6 +67,7 @@ namespace C4IT_CustomerPanel private DispatcherTimer _adHocTimer; private DispatcherTimer _regularTimer; private DispatcherTimer _checkServerConnectionTimer; + private const double HeaderCaptionHeight = 72d; private bool _initialTimerInvocationDone = false; private bool _manualRefreshInProgress = false; private TimeSpan _lastTicketInterval; @@ -506,10 +507,7 @@ namespace C4IT_CustomerPanel private void SetAppearance(bool firstStart) { - if (!ConfigSettings.GetConfig()._isDraggable) - { - ResetLocation(); - } + ApplyWindowDraggableState(); System.Collections.ObjectModel.Collection themes = new System.Collections.ObjectModel.Collection(); if (ConfigSettings.GetConfig()._iconColor != 0) @@ -559,6 +557,18 @@ namespace C4IT_CustomerPanel } } + private void ApplyWindowDraggableState() + { + bool draggable = ConfigSettings?.GetConfig()?._isDraggable ?? true; + + if (!draggable) + ResetLocation(); + + WindowChrome chrome = WindowChrome.GetWindowChrome(this); + if (chrome != null) + chrome.CaptionHeight = draggable ? HeaderCaptionHeight : 0d; + } + public void ResetLocation() { var CM = MethodBase.GetCurrentMethod(); diff --git a/libs/configHelper.cs b/libs/configHelper.cs index f9829b5..4a82588 100644 --- a/libs/configHelper.cs +++ b/libs/configHelper.cs @@ -1384,6 +1384,7 @@ namespace C4IT_CustomerPanel.libs cpConfig = JsonConvert.DeserializeObject(json); cpConfig._encryptedApiToken = CustomerPanelSecurePassword.Instance.Decode(cpConfig._encryptedApiToken); + LogEntry($"[Config API] _isDraggable={cpConfig?._isDraggable}", LogLevels.Debug); if (cpConfig?._uiColors != null && cpConfig._uiColors.TryGetValue("activeButtonColor", out string apiActiveColor) && !string.IsNullOrWhiteSpace(apiActiveColor)) LogEntry($"[Config API] activeButtonColor={apiActiveColor}", LogLevels.Debug);