diff --git a/Dashboard/Controls/QueryPerformanceContent.xaml.cs b/Dashboard/Controls/QueryPerformanceContent.xaml.cs index 1757e031..59d59287 100644 --- a/Dashboard/Controls/QueryPerformanceContent.xaml.cs +++ b/Dashboard/Controls/QueryPerformanceContent.xaml.cs @@ -761,6 +761,7 @@ private void ApplyQueryStoreFilters() private void QueryStoreDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + if (!TabHelpers.IsDoubleClickOnRow((DependencyObject)e.OriginalSource)) return; if (_databaseService == null) return; if (QueryStoreDataGrid.SelectedItem is QueryStoreItem item) @@ -793,6 +794,7 @@ private void QueryStoreDataGrid_MouseDoubleClick(object sender, MouseButtonEvent private void ProcStatsDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + if (!TabHelpers.IsDoubleClickOnRow((DependencyObject)e.OriginalSource)) return; if (_databaseService == null) return; if (ProcStatsDataGrid.SelectedItem is ProcedureStatsItem item) @@ -825,6 +827,7 @@ private void ProcStatsDataGrid_MouseDoubleClick(object sender, MouseButtonEventA private void QueryStatsDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + if (!TabHelpers.IsDoubleClickOnRow((DependencyObject)e.OriginalSource)) return; if (_databaseService == null) return; if (QueryStatsDataGrid.SelectedItem is QueryStatsItem item) diff --git a/Dashboard/Helpers/TabHelpers.cs b/Dashboard/Helpers/TabHelpers.cs index fff1b7cf..0a671f07 100644 --- a/Dashboard/Helpers/TabHelpers.cs +++ b/Dashboard/Helpers/TabHelpers.cs @@ -28,6 +28,23 @@ namespace PerformanceMonitorDashboard.Helpers /// public static class TabHelpers { + /// + /// Returns true if a double-click originated from a DataGridRow (not a header). + /// Use at the top of MouseDoubleClick handlers to prevent header clicks from + /// triggering row actions. + /// + public static bool IsDoubleClickOnRow(DependencyObject originalSource) + { + var dep = originalSource; + while (dep != null) + { + if (dep is DataGridRow) return true; + if (dep is DataGridColumnHeader) return false; + dep = VisualTreeHelper.GetParent(dep); + } + return false; + } + /// /// Material Design 300-level color palette for chart data series. /// Soft pastels optimized for dark backgrounds, ordered to map 1:1 diff --git a/Dashboard/ManageServersWindow.xaml.cs b/Dashboard/ManageServersWindow.xaml.cs index d6b81558..4ce1eaf1 100644 --- a/Dashboard/ManageServersWindow.xaml.cs +++ b/Dashboard/ManageServersWindow.xaml.cs @@ -34,6 +34,7 @@ private void LoadServers() private void ServersDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { + if (!Helpers.TabHelpers.IsDoubleClickOnRow((DependencyObject)e.OriginalSource)) return; EditSelectedServer(); } diff --git a/Dashboard/ServerTab.xaml.cs b/Dashboard/ServerTab.xaml.cs index 9ee1de2d..055fb452 100644 --- a/Dashboard/ServerTab.xaml.cs +++ b/Dashboard/ServerTab.xaml.cs @@ -1356,6 +1356,7 @@ await Task.WhenAll( private void HealthDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { + if (!Helpers.TabHelpers.IsDoubleClickOnRow((DependencyObject)e.OriginalSource)) return; if (HealthDataGrid.SelectedItem is CollectionHealthItem item) { var logWindow = new CollectionLogWindow(item.CollectorName, _databaseService);