From 4835c3f1e9c5b1fb89e5fc5bc39df172a8a43a9c Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 15 Nov 2024 10:50:52 +0800 Subject: [PATCH] enhance: do NOT trigger double clicking events when user click the blank area of ListBox Signed-off-by: leo --- src/Views/Histories.axaml.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 85092b64..976d46cb 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -730,9 +730,12 @@ namespace SourceGit.Views private void OnCommitListDoubleTapped(object sender, TappedEventArgs e) { - if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } selected }) + if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } } listBox) { - histories.DoubleTapped(selected[0] as Models.Commit); + var source = e.Source as Control; + var item = source.FindAncestorOfType(); + if (item is { DataContext: Models.Commit commit }) + histories.DoubleTapped(commit); } e.Handled = true; }