From d67b02bae39aa90313e6b57eb54774bb26346794 Mon Sep 17 00:00:00 2001 From: Davide Giacometti Date: Wed, 20 Mar 2024 19:17:24 +0100 Subject: [PATCH] [Peek]Fix TitleBar Drag Region and unclickable open button issues (#32004) --- .../peek/Peek.UI/PeekXAML/Views/TitleBar.xaml.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/modules/peek/Peek.UI/PeekXAML/Views/TitleBar.xaml.cs b/src/modules/peek/Peek.UI/PeekXAML/Views/TitleBar.xaml.cs index 50f7da2cc9..6dc2638550 100644 --- a/src/modules/peek/Peek.UI/PeekXAML/Views/TitleBar.xaml.cs +++ b/src/modules/peek/Peek.UI/PeekXAML/Views/TitleBar.xaml.cs @@ -82,6 +82,8 @@ namespace Peek.UI.Views { InitializeComponent(); TitleBarRootContainer.SizeChanged += TitleBarRootContainer_SizeChanged; + + LaunchAppButton.RegisterPropertyChangedCallback(VisibilityProperty, LaunchAppButtonVisibilityChangedCallback); } public IFileSystemItem Item @@ -117,6 +119,9 @@ namespace Peek.UI.Views if (AppWindowTitleBar.IsCustomizationSupported()) { UpdateTitleBarCustomization(mainWindow); + + // Ensure the drag region of the title bar is updated on first Peek activation + UpdateDragRegion(); } else { @@ -357,5 +362,16 @@ namespace Peek.UI.Views OpenWithAppToolTip = string.Empty; } } + + /// + /// Ensure the drag region of the title bar is updated when the visibility of the launch app button changes. + /// + private async void LaunchAppButtonVisibilityChangedCallback(DependencyObject sender, DependencyProperty dp) + { + // Ensure the ActualWidth is updated + await Task.Delay(100); + + UpdateDragRegion(); + } } }