Returns the offset of the
public static Vector GetOffset(
You cannot use methods in XAML.
The returned offset value is relative to the parent of the
. If you want to return an offset value that is not relative to the parent of a Visual , use the Visual method. TransformToAncestor
The following markup example shows a
that is defined with TextBlock value of 4. Margin
< TextBlock Name = " myTextBlock " Margin = " 4 " Text = " Hello, world " />
The following code example shows how to use the
method to retrieve the offset of the GetOffset . The offset values are contained within the returned TextBlock value. Vector
// 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 offset takes into account the
value. In this case, Margin is 4, and X is 4. Y
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Supported in: 3.5, 3.0