Share via


LayoutInformation Klasse

Definition

Definiert Methoden, die zusätzliche Informationen zum Layout eines Elements bereitstellen.

public ref class LayoutInformation sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class LayoutInformation final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class LayoutInformation
Public NotInheritable Class LayoutInformation
Vererbung
Object Platform::Object IInspectable LayoutInformation
Attribute

Windows-Anforderungen

Gerätefamilie
Windows 10 (eingeführt in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v1.0)

Beispiele

Das folgende Beispiel zeigt, wie Sie GetLayoutSlot verwenden und das Begrenzungsfeld für das Rechteck zeichnen.

<StackPanel x:Name="sp1" Grid.Row="0" Background="LightBlue"
            Height="100" Width="200"
            HorizontalAlignment="Left" VerticalAlignment="Top" >
    <Rectangle x:Name="rect1" Fill="Blue"  Width="100" Height="50" ></Rectangle>
</StackPanel>
<Button Content="Get Layout Slot" 
        Grid.Row="1" Width="150" Height="50" 
        Click="Button_Click" HorizontalAlignment="Left"/>
private void Button_Click(object sender, RoutedEventArgs e)
{
    //Get Layout Slot of Rectangle
    Windows.Foundation.Rect r1 = LayoutInformation.GetLayoutSlot(rect1);
    RectangleGeometry rg1 = new RectangleGeometry();
    rg1.Rect = r1;
    Path mypath = new Path();
    mypath.Data = rg1;
    mypath.Stroke = new SolidColorBrush(Colors.Red);
    mypath.StrokeThickness = 4;
    LayoutRoot.Children.Add(mypath);
}
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    'Get Layout Slot of Rectangle 
    Dim r1 As Rect = LayoutInformation.GetLayoutSlot(rect1)
    Dim rg1 As New RectangleGeometry()
    rg1.Rect = r1
    Dim mypath As New Path()
    mypath.Data = rg1
    mypath.Stroke = New SolidColorBrush(Colors.Black)
    mypath.StrokeThickness = 4
    LayoutRoot.Children.Add(mypath)
End Sub

Hinweise

Versionsverlauf

Windows-Version SDK-Version Wertschöpfung
1709 16299 GetAvailableSize

Methoden

GetAvailableSize(UIElement)

Gibt den Size-Wert zurück, der zuletzt zum Messen des angegebenen Elements verwendet wurde.

GetLayoutExceptionElement(Object)

Gibt das Element zurück, das zum Zeitpunkt einer nicht behandelten Ausnahme vom Layoutsystem verarbeitet wurde.

GetLayoutSlot(FrameworkElement)

Gibt den Layoutslot oder das umgebende Feld zurück, das das angegebene Element enthält.

Gilt für: