Public Access
Desktop: decide a titlebar double-click on the press, before the drag can swallow it
This commit is contained in:
1 parent
079a273d46
commit
a2362d1e3e
6 files changed
+127
-3
No files matched your search
@@ -9,6 +9,8 @@ internal sealed partial class SettingsTitleBar : UserControl
|
||||
{
|
||||
public SettingsTitleBar() => InitializeComponent();
|
||||
|
||||
private readonly CaptionPresses presses = new();
|
||||
|
||||
private Window? Host => TopLevel.GetTopLevel(this) as Window;
|
||||
|
||||
/// <summary>Left button only, and only on a press nothing inside the bar has already handled.</summary>
|
||||
@@ -19,6 +21,15 @@ internal sealed partial class SettingsTitleBar : UserControl
|
||||
return;
|
||||
}
|
||||
|
||||
// Decided on the press, before the drag would take it: see CaptionPresses.
|
||||
if (presses.IsSecond(e, this))
|
||||
{
|
||||
OnToggleMaximised(sender, e);
|
||||
e.Handled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Host?.BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
@@ -31,6 +42,7 @@ internal sealed partial class SettingsTitleBar : UserControl
|
||||
}
|
||||
|
||||
/// <summary>Both the button and a double-click on the bar arrive here, as Windows convention expects.</summary>
|
||||
/// <remarks>The double-click by way of <see cref="OnDrag"/>; see <see cref="CaptionPresses"/>.</remarks>
|
||||
private void OnToggleMaximised(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Host is not { } window)
|
||||
|
||||
Reference in new issue
Block a user