Condividi tramite


LayoutInformation Classe

Definizione

Definisce i metodi che forniscono informazioni aggiuntive sul layout di un elemento.

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
Ereditarietà
Object Platform::Object IInspectable LayoutInformation
Attributi

Esempio

Nell'esempio seguente viene illustrato come usare GetLayoutSlot e disegnare il rettangolo di selezione per Il rettangolo.

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

Metodi

GetAvailableSize(UIElement)

Restituisce il valore Size utilizzato più di recente per misurare l'elemento specificato.

GetLayoutExceptionElement(Object)

Restituisce l'elemento elaborato dal sistema di layout al momento di un'eccezione non gestita.

GetLayoutSlot(FrameworkElement)

Restituisce lo slot di layout o il rettangolo di selezione contenente l'elemento specificato.

Si applica a