Skip to content

Commit a6406c0

Browse files
committed
Fix NavigationView content header grid splitting width 50/50
LayoutNodeFactory was not propagating FlexFactor from ColumnContainer to LayoutNode, so all columns defaulted to FlexFactor=1.0 regardless of the control's setting. The toolbar column in NavigationView's content header now correctly sizes to content (FlexFactor=0) while the title column takes remaining space.
1 parent 2b7fd03 commit a6406c0

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

SharpConsoleUI/Controls/NavigationView/NavigationView.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ public NavigationView()
116116
_contentHeaderGrid.Margin = new Margin(0, 1, 0, 0);
117117

118118
_contentHeaderTitleColumn = new ColumnContainer(_contentHeaderGrid);
119-
_contentHeaderToolbarColumn = new ColumnContainer(_contentHeaderGrid);
119+
_contentHeaderToolbarColumn = new ColumnContainer(_contentHeaderGrid)
120+
{
121+
FlexFactor = 0 // Toolbar column sizes to content; title column takes remaining space
122+
};
120123

121124
_contentHeaderTitleColumn.AddContent(_contentHeader);
122125

SharpConsoleUI/Layout/LayoutNodeFactory.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ public static LayoutNode CreateSubtree(IWindowControl control)
8181
{
8282
var childNode = CreateSubtree(child);
8383
childNode.IsVisible = child.Visible;
84+
85+
// Propagate FlexFactor from ColumnContainer to LayoutNode
86+
if (child is ColumnContainer column)
87+
{
88+
childNode.FlexFactor = column.FlexFactor;
89+
}
90+
8491
node.AddChild(childNode);
8592
}
8693
}

0 commit comments

Comments
 (0)