3 ms·
After my rant day, here examples from my work day: I need to lay out two data-tables in a dialog, with 50% to each. I also need label headers above each section
by fifticon 7y ago
After my rant day, here examples from my work day:
I need to lay out two data-tables in a dialog, with 50% to each. I also need label headers above each section. The tables must grow and share available space, the labels stay put. In WPF, this 'daily driver' task, requires this:
- it can't be solved with DockPanel (which is OK.)
- it can't be solved with hbox(StackPanel), because of StackPanel's broken design (ie not handling resizing children.)
- so I'm forced to use Grid.. Which, for this trivial task, requires this:
<Grid Margin="0,10,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
And then, on each of my 4 children, I have to put these:
..Grid.Column="1" Grid.Row="1"
What a bloated inelegant mess.
I don't want to specify absolute indices on my grid children, I want it handled by nesting or symbolic row identifiers (anything where I don't have to count/update row/column indices by hand.)
I'm not happy, that the layout rules for grids have their own "", "number", "number", "number%" system independent of the hor/vert alignment system.
I don't want to specify an absolute height on my label row.