enhance: do NOT trigger double clicking events when user click the blank area of ListBox

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-11-15 10:50:52 +08:00
parent a5606e80d4
commit 4835c3f1e9
No known key found for this signature in database

View file

@ -730,9 +730,12 @@ namespace SourceGit.Views
private void OnCommitListDoubleTapped(object sender, TappedEventArgs e) 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<ListBoxItem>();
if (item is { DataContext: Models.Commit commit })
histories.DoubleTapped(commit);
} }
e.Handled = true; e.Handled = true;
} }