GetLayoutSlot Method
Collapse the table of content
Expand the table of content

LayoutInformation.GetLayoutSlot Method (FrameworkElement)

 

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 Shared Function GetLayoutSlot (
	element As FrameworkElement
) As Rect

Parameters

element
Type: System.Windows.FrameworkElement

The FrameworkElement whose layout slot is desired.

Return Value

Type: System.Windows.Rect

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.

Private Sub getLayoutSlot1(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim myRectangleGeometry As New RectangleGeometry
    myRectangleGeometry.Rect = LayoutInformation.GetLayoutSlot(txt1)
    Dim myGeometryDrawing As New GeometryDrawing
    Dim myPath As 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()
End Sub

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft