The LayoutInformation
class has two static methods – GetLayoutClip and GetLayoutSlot.
The GetLayoutClip
method returns a Geometry that represents the visible region of an element.
The
GetLayoutSlot method returns the entire bounding rectangle of an element.
The code
snippet below calls GetLayoutClip and GetLayoutSlot methods to get layout clip
and layout slot of a TextBlock element.
Geometry
clipGeometry = LayoutInformation.GetLayoutClip(textBlock1);
Rect
layoutRectangle = LayoutInformation.GetLayoutSlot(textBlock1);
textBlock1.Text = "Layout:
" + layoutRectangle.ToString();