Skip to content

Commit 4835c3f

Browse files
committed
enhance: do NOT trigger double clicking events when user click the blank area of ListBox
Signed-off-by: leo <[email protected]>
1 parent a5606e8 commit 4835c3f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Views/Histories.axaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,9 +730,12 @@ private void OnCommitListContextRequested(object sender, ContextRequestedEventAr
730730

731731
private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
732732
{
733-
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } selected })
733+
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems: { Count: 1 } } listBox)
734734
{
735-
histories.DoubleTapped(selected[0] as Models.Commit);
735+
var source = e.Source as Control;
736+
var item = source.FindAncestorOfType<ListBoxItem>();
737+
if (item is { DataContext: Models.Commit commit })
738+
histories.DoubleTapped(commit);
736739
}
737740
e.Handled = true;
738741
}

0 commit comments

Comments
 (0)