I’ve looked over the docs for the StackPanel and could not find any way to apply padding to the children attached to a control or a StackPanel, is this possible or do I need to apply padding to each element control?
Hey do you mind creating a small PG to repro what you want to achieve? I’m sure we will find a way
Hi guys. If I may slide-in… https://www.babylonjs-playground.com/#11NJQT#23 … nice starting place, perhaps.
If I understand original post, i73 wishes to set some properties on the stackpanel (and maybe on certain other containers)… that set margin space around each child automatically, no matter how many children. Sort of like… stackpanel.allChildrenMarginTop / bottom / left / right, etc. Probably same wanted for grid. Wants to avoid setting same paddings on many children, over and over.
Or I could be completely wrong.
@Deltakosh for sure, Wingnut supplied a perfect one
and @Wingnut that’s exactly what I’m wondering. Of course
butt1.paddingBottom = "3px"; acts as the modifier, but I’m so used to WPF and XAML where the parent will control the children element properties (padding, size, etc) just wondering if Babylon does the same?
It’s not a huge concern to me just wanted to know if it’s possible or not.
This thread sort of died, eh? They do that, sometimes.
In my poor opinion, “spaced” containers like stackPanel and grid… having some “doThisToEachOfMyChildren” powers… COULD “fight with” the currently-used measuring system. But, that’s just a guess.
MAYBE… one property on grid and stackpanel… .cellPadding = xx … just one value… puts xx space around all sides of all contained children. MAYBE. Again, this might be against the general design of the rest of the GUI system, maybe not plausible. (but still a fine, worthwhile idea).
I think there is a beforeRender on the GUI systems… where a person COULD iterate/loop thru all children of a container, and pad all the children in one little loop, and then markAsDirty to get a re-measure/re-flow before first-render. shrug
@Deltakosh, thoughts? Anyone else? (thx)
We are not cloning XAML and I think the thread is answered by your example right? Each button has a paddingBottom to define the distance with the next one (Actually exactly like in XAML here :))
Did I miss something?
Yeah I understand, you get into the issue of what element handles what.
For me it wasn’t a huge issue I just was looking for a solution to handling all stack panel children and it looks like I’ll just iterate them and apply the padding to them.
Nah, I don’t think so. I didn’t know if you were thinking about a modification or not. No problems happening… just a curiosity about a potential feature-addition. Seems like everyone is rolling, here, thx.