[Peek]Fix TitleBar Drag Region and unclickable open button issues (#32004)

This commit is contained in:
Davide Giacometti
2024-03-20 19:17:24 +01:00
committed by GitHub
parent 42fb394bf3
commit d67b02bae3

View File

@@ -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;
}
}
/// <summary>
/// Ensure the drag region of the title bar is updated when the visibility of the launch app button changes.
/// </summary>
private async void LaunchAppButtonVisibilityChangedCallback(DependencyObject sender, DependencyProperty dp)
{
// Ensure the ActualWidth is updated
await Task.Delay(100);
UpdateDragRegion();
}
}
}