From a36f6d53a66848d36bf9c40ec81a002a63fc9597 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 6 Jun 2026 21:46:27 +0200 Subject: [PATCH] Don't treat a column-header double-click as a row activation The metadata grid's double-tap handler activated grid.SelectedItem, so rapidly clicking a column-header sort button registered as a double click and navigated to the selected row. Resolve the row from the double-tapped element instead and activate only when the double-click actually landed on a data row. Assisted-by: Claude:claude-opus-4-8:Claude Code --- ILSpy/Views/MetadataTablePage.axaml.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ILSpy/Views/MetadataTablePage.axaml.cs b/ILSpy/Views/MetadataTablePage.axaml.cs index 5d9e56109..1bb5aaf59 100644 --- a/ILSpy/Views/MetadataTablePage.axaml.cs +++ b/ILSpy/Views/MetadataTablePage.axaml.cs @@ -79,8 +79,13 @@ namespace ILSpy.Views // in OnGridPointerPressed. if (DataContext is not MetadataTablePageModel page) return; - var grid = this.FindControl("Grid"); - if (grid?.SelectedItem is { } row) + // Resolve the row from the double-tapped element rather than grid.SelectedItem: a + // double-click on a column header (e.g. rapidly toggling its sort button) must NOT + // navigate to the currently-selected row — only a double-click on a data row does. + var visual = e.Source as Visual; + while (visual is not null and not DataGridRow) + visual = visual.GetVisualParent(); + if (visual is DataGridRow { DataContext: { } row }) page.RaiseRowActivated(row); }