How to obtain the scaled size of a WPF Visual element

I know lots of time passed since the question was asked but it doesn't hurt to post some more info :)

I use this code to find size (scale) of visuals with applied render transform(s).

GeneralTransform t = transformedVisual.TransformToVisual(parentVisual);

Vector topLeft = (Vector) t.Transform(new Point(0,0));
Vector topRight = (Vector) t.Transform(new Point(originalWidthOfTransformedVisual, 0));

double renderedWidth = (topRight-topLeft).Length;
double widthScale = renderedWidth / originalWidthOfTransformedVisual;

Tags:

Wpf