LayoutInformation class

Applies to Windows and Windows Phone

Defines methods that provide additional information about the layout of an element.

Inheritance

Object
  LayoutInformation

Syntax


public sealed class LayoutInformation

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The LayoutInformation class has these types of members:

Methods

The LayoutInformation class has these methods. It also inherits methods from the Object class.

MethodDescription
GetLayoutExceptionElement Returns the element that was being processed by the layout system at the moment of an unhandled exception.
GetLayoutSlot Returns the layout slot, or bounding box, that contains the specified element.

 

Examples

The following example shows how to use GetLayoutSlot and draw the bounding box for the Rectangle.


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


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls.Primitives
Windows::UI::Xaml::Controls::Primitives [C++]

Metadata

Windows.winmd

 

 

Show:
© 2014 Microsoft