LayoutInformation Classe

Definição

Define métodos que fornecem informações adicionais sobre o layout de um elemento.

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
Herança
Object Platform::Object IInspectable LayoutInformation
Atributos

Requisitos do Windows

Família de dispositivos
Windows 10 (introduzida na 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduzida na v1.0)

Exemplos

O exemplo a seguir mostra como usar GetLayoutSlot e desenhar a caixa delimitadora para o Retângulo.

<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

Comentários

Histórico de versão

Versão do Windows Versão do SDK Valor adicionado
1.709 16299 ObterAvailableSize

Métodos

GetAvailableSize(UIElement)

Retorna o valor Size usado mais recentemente para medir o elemento especificado.

GetLayoutExceptionElement(Object)

Retorna o elemento que estava sendo processado pelo sistema de layout no momento de uma exceção sem tratamento.

GetLayoutSlot(FrameworkElement)

Retorna o slot de layout, ou caixa delimitadora, que contém o elemento especificado.

Aplica-se a