Lire en anglais Modifier

Partager via


LayoutInformation Class

Definition

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

C#
public static class LayoutInformation
Inheritance
LayoutInformation

Examples

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

C#
private void getLayoutSlot1(object sender, System.Windows.RoutedEventArgs e)
{
    RectangleGeometry myRectangleGeometry = new RectangleGeometry();
    myRectangleGeometry.Rect = LayoutInformation.GetLayoutSlot(txt1);
    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();
}

Methods

GetLayoutClip(FrameworkElement)

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

GetLayoutExceptionElement(Dispatcher)

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

GetLayoutSlot(FrameworkElement)

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

Applies to

Produit Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10