DIconLayout size problem

So I’m using DIconLayout with a custom panel at the moment but I got a small problem:

I need the lower icons to go where the blue line.
It only needs to happen if there’s empty space, which there is.
How can I achieve that?

I tried to use docking and margins but my head hurts from trying to figure out how to detect if there is a panel beneath (if yes margin to 4) or not (otherwise margin to whatever height is needed to retain size)