Export (0) Print
Expand All

LayoutInformation.GetLayoutSlot Method

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

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

public static Rect GetLayoutSlot (
	FrameworkElement element
)
public static Rect GetLayoutSlot (
	FrameworkElement element
)
public static function GetLayoutSlot (
	element : FrameworkElement
) : Rect
You cannot use methods in XAML.

Parameters

element

The FrameworkElement whose layout slot is desired.

Return Value

A Rect that represents the layout slot of the element.

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

public 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();
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2015 Microsoft