From dbc1c67b9c1df730e031c8dbb94d32d214327eca Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Thu, 5 Mar 2026 12:58:37 -0500 Subject: [PATCH] Fix warnings gap in properties panel (#29) Warning items were added outside their Expander (directly to PropertiesContent), leaving an empty Expander header with a visible gap. Now both Plan Warnings and operator Warnings create their own Expander with a StackPanel content so items render inside the collapsible section with no gap. Co-Authored-By: Claude Opus 4.6 --- .../Controls/PlanViewerControl.axaml.cs | 52 +++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs b/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs index 55de492..90d0b97 100644 --- a/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs +++ b/src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs @@ -1465,7 +1465,7 @@ private void ShowPropertiesPanel(PlanNode node) // === Plan-Level Warnings === if (s.PlanWarnings.Count > 0) { - AddPropertySection("Plan Warnings"); + var planWarningsPanel = new StackPanel(); foreach (var w in s.PlanWarnings) { var warnColor = w.Severity == PlanWarningSeverity.Critical ? "#E57373" @@ -1486,8 +1486,30 @@ private void ShowPropertiesPanel(PlanNode node) TextWrapping = TextWrapping.Wrap, Margin = new Thickness(16, 0, 0, 0) }); - (_currentPropertySection ?? PropertiesContent).Children.Add(warnPanel); + planWarningsPanel.Children.Add(warnPanel); } + + var planWarningsExpander = new Expander + { + IsExpanded = true, + Header = new TextBlock + { + Text = "Plan Warnings", + FontWeight = FontWeight.SemiBold, + FontSize = 11, + Foreground = SectionHeaderBrush + }, + Content = planWarningsPanel, + Margin = new Thickness(0, 2, 0, 0), + Padding = new Thickness(0), + Foreground = SectionHeaderBrush, + Background = new SolidColorBrush(Color.FromArgb(0x18, 0x4F, 0xA3, 0xFF)), + BorderBrush = PropSeparatorBrush, + BorderThickness = new Thickness(0, 0, 0, 1), + HorizontalAlignment = HorizontalAlignment.Stretch, + HorizontalContentAlignment = HorizontalAlignment.Stretch + }; + PropertiesContent.Children.Add(planWarningsExpander); } // === Missing Indexes === @@ -1506,7 +1528,7 @@ private void ShowPropertiesPanel(PlanNode node) // === Warnings === if (node.HasWarnings) { - AddPropertySection("Warnings"); + var warningsPanel = new StackPanel(); foreach (var w in node.Warnings) { var warnColor = w.Severity == PlanWarningSeverity.Critical ? "#E57373" @@ -1527,8 +1549,30 @@ private void ShowPropertiesPanel(PlanNode node) TextWrapping = TextWrapping.Wrap, Margin = new Thickness(16, 0, 0, 0) }); - PropertiesContent.Children.Add(warnPanel); + warningsPanel.Children.Add(warnPanel); } + + var warningsExpander = new Expander + { + IsExpanded = true, + Header = new TextBlock + { + Text = "Warnings", + FontWeight = FontWeight.SemiBold, + FontSize = 11, + Foreground = SectionHeaderBrush + }, + Content = warningsPanel, + Margin = new Thickness(0, 2, 0, 0), + Padding = new Thickness(0), + Foreground = SectionHeaderBrush, + Background = new SolidColorBrush(Color.FromArgb(0x18, 0x4F, 0xA3, 0xFF)), + BorderBrush = PropSeparatorBrush, + BorderThickness = new Thickness(0, 0, 0, 1), + HorizontalAlignment = HorizontalAlignment.Stretch, + HorizontalContentAlignment = HorizontalAlignment.Stretch + }; + PropertiesContent.Children.Add(warningsExpander); } // Show the panel