// Return the offset vector for the TextBlock object.
Vector vector = VisualTreeHelper.GetOffset(myTextBlock);
// Convert the vector to a point value.
Point currentPoint = new Point(vector.X, vector.Y);
The following code example shows how to use the TransformToAncestor method to retrieve the offset of the TextBlock relative to the containing Window. The offset values are contained in the returned GeneralTransform.
// Return the general transform for the specified visual object.
GeneralTransform generalTransform1 = myTextBlock.TransformToAncestor(this);
// Retrieve the point value relative to the parent.
Point currentPoint = generalTransform1.Transform(new Point(0, 0));
The offset takes into account the Margin values for all objects within the containing Window. In this case, X is 28, and Y is 28.