Fill Alignment
Is your feature request related to a problem? Please describe.
I am trying to do something like godot's vbox and hbox containers where I can put items in and they stack on top of eachother,
But the issue is that in godot you can tell items to take up all remaining space and share it evenly with other items set to fill.
This is not possible in avalonia without grid, But grid required manually specifiying a rows and columns for each item and the row and columns definitions for every grid.
I just want them to stack horizontally or vertically and have the ability to either set the stack panel to fill it's item's evenly or tell the item in the stack panel to take4 up as much space as possiable sharing it with it's siblings.
Describe the solution you'd like
- Add HorizontalAlignment.Fill to Control
- Add VerticalAlignment.Fill to Control
- Add DefaultItemHorizontalAlignment to StackPanel
- Add DefaultItemVerticalAlignment to StackPanel
Describe alternatives you've considered
using grid and manually specifying everything
Additional context
Fill mode would take up as much remaining space as possible sharing it with it's siblings. this means if you have two children with fill mode they take up all the space remaining divided by two with margins and padding removed.
See also https://github.com/AvaloniaUI/Avalonia/issues/16962
using grid and manually specifying everything
There was the old auto grid control which is probably close to what you want. But it has not been updated in years at this point and is likely very broken.
https://github.com/AvaloniaUI/AvaloniaAutoGrid
Fill mode would take up as much remaining space as possible sharing it with it's siblings.
For a Stack Panel this probably does not make sense. My understanding is Stack Panels sort of have infinite width/height. So there is no "remaining" space for it to take up. A grid on the other hand uses specific cells with finite dimensions. You could make a custom panel that does this though,
Is a stack panel the same as a box container? They act similar, and if they are the dimensions would be the size of the stack panel.
I don't know what you mean by box container, but as far as I am aware a stack panel has infinite space in a single direction. You can see that by putting lots of stuff in a stack panel without a scroll viewer. In which case the contents will likely exceed the bounds of the stack panel/window. You can work around that by putting the stack panel itself in a container with finite dimensions (EG a grid).
The actual stack panel bounds are only used for the direction opposite the orientation.