Compartir a través de


LayoutInformation.GetLayoutSlot(FrameworkElement) Método

Definición

Devuelve un Rect que representa la partición de diseño que se reserva para un elemento secundario.

public:
 static System::Windows::Rect GetLayoutSlot(System::Windows::FrameworkElement ^ element);
public static System.Windows.Rect GetLayoutSlot (System.Windows.FrameworkElement element);
static member GetLayoutSlot : System.Windows.FrameworkElement -> System.Windows.Rect
Public Shared Function GetLayoutSlot (element As FrameworkElement) As Rect

Parámetros

element
FrameworkElement

FrameworkElement cuya ranura de diseño se desea.

Devoluciones

Rect que representa la ranura de diseño del elemento.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el GetLayoutSlot método para traducir el rectángulo delimitador de en FrameworkElement .GeometryDrawing

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

Se aplica a