Can't set Root node to the middle of the window (Rect NaN)

I am trying to get a root node to appear in the middle when the window is open.
When I try using contentRect the values are NaN.

I tried subscribing to a geometry changed event but I don’t want to call this every single time the window changes, I just want it to be there at the very beginning.

Any way I could do it?

    public void SetRootNode()
    {
        BTNode _node = new BTNode();
        _node.Initialize(true);
        Rect startPosition = new Rect(
            contentRect.width / 2,
            contentRect.height / 2,
            5,
            5
        );
        Debug.Log(startPosition);
        _node.SetPosition(startPosition);
        
        AddElement(_node);
    }