LayoutInformation Class

 

Defines methods that provide additional information about the layout state of an element.

Namespace:   System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)

System.Object
  System.Windows.Controls.Primitives.LayoutInformation

public static class LayoutInformation

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticGetLayoutClip(FrameworkElement)

Returns a Geometry that represents the visible region of an element.

System_CAPS_pubmethodSystem_CAPS_staticGetLayoutExceptionElement(Dispatcher)

Returns a UIElement that was being processed by the layout engine at the moment of an unhandled exception.

System_CAPS_pubmethodSystem_CAPS_staticGetLayoutSlot(FrameworkElement)

Returns a Rect that represents the layout partition that is reserved for a child element.

The following example demonstrates how to use the GetLayoutSlot method to translate the bounding box of a FrameworkElement into a GeometryDrawing.

private void getLayoutSlot1(object sender, System.Windows.RoutedEventArgs e)
{
    RectangleGeometry myRectangleGeometry = new RectangleGeometry();
    myRectangleGeometry.Rect = LayoutInformation.GetLayoutSlot(txt1);
    GeometryDrawing myGeometryDrawing = new GeometryDrawing();
    Path myPath = new Path();
    myPath.Data = myRectangleGeometry;
    myPath.Stroke = Brushes.LightGoldenrodYellow;
    myPath.StrokeThickness = 5;
    Grid.SetColumn(myPath, 0);
    Grid.SetRow(myPath, 0);
    myGrid.Children.Add(myPath);
    txt2.Text = "LayoutSlot is equal to " + LayoutInformation.GetLayoutSlot(txt1).ToString();
}

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: