How do I reference UI transform parent?

I’ve read several “how to reference parent” answers that tell me to do what I’m doing but it keeps throwing the “object reference is required” error.

I have a UI element with a child attached. I have written a script and attached it to the child to manipulate its transform. It works great.

However, I now need to adjust my transforms according to the parent dimensions. i.e. When the parent UI element changes size, I need to adjust my numbers accordingly. Here are a few things I have tried:

transform tParent=transform.parent.transform;
float fHeight=transform.parent.transform.y;

Basically, no matter how I try to reference the parent, either as a transform object or one of its attributes, I get the object reference error.

What am I missing?

transform.parent.position.y

Answer:

Rect r;
RectTransform rt;
float h;

rt=This.GetComponent();
r=rt.rect;
h=r.height;