How to resize a NinePatchRect to wrap its children with a padding?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By darthdeus

I have a NinePatchRect that has a GridContainer in it which has a bunch of items. The GridContainer takes care of laying out its children in a grid, but I can’t seem to find a way to get the NinePatchRect to expand so that it contains the GridContainer. I’d also like to specify a “padding” so that NinePatchRect expands a bit more than needed.

enter image description here

enter image description here

Ideally it would look something like this, which I achieved by manually moving the GridContainer’s transform a bit to the bottom right, and expanding the NinePatchRect accordingly.

Is there a way to achieve this using Godot’s UI without having to implement all the calculations in scripts?

enter image description here