LayoutInformation 클래스

정의

요소의 레이아웃에 대한 추가 정보를 제공하는 메서드를 정의합니다.

public ref class LayoutInformation sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 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(Microsoft.UI.Xaml.WinUIContract), 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
상속
Object Platform::Object IInspectable LayoutInformation
특성

예제

다음 예제에서는 GetLayoutSlot 을 사용하고 사각형에 대한 경계 상자를 그리는 방법을 보여 줍니다.

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

메서드

GetAvailableSize(UIElement)

지정된 요소를 측정하는 데 가장 최근에 사용된 Size 값을 반환합니다.

GetLayoutExceptionElement(Object)

처리되지 않은 예외가 발생하는 시점에 레이아웃 시스템에서 처리 중인 요소를 반환합니다.

GetLayoutSlot(FrameworkElement)

지정된 요소를 포함하는 레이아웃 슬롯 또는 경계 상자를 반환합니다.

적용 대상