LayoutInformation LayoutInformation LayoutInformation LayoutInformation Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
Defines methods that provide additional information about the layout of an element.

public : sealed class LayoutInformation : ILayoutInformationpublic sealed class LayoutInformation : ILayoutInformationPublic NotInheritable Class LayoutInformation Implements ILayoutInformation// This API is not available in Javascript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

Methods

GetAvailableSize(UIElement) GetAvailableSize(UIElement) GetAvailableSize(UIElement) GetAvailableSize(UIElement)

Prerelease. Returns the Size value that was most recently used to measure the specified element.

public : static Size GetAvailableSize(UIElement element)public static Size GetAvailableSize(UIElement element)Public Static Function GetAvailableSize(element As UIElement) As Size// This API is not available in Javascript.
Parameters
element
UIElement UIElement UIElement UIElement

The element for which to return the most recent size.

Returns

The Size given as an argument on the most recent call to measure this element, or a Size of 0,0 if the element has not been measured yet.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16257.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

GetLayoutExceptionElement(Object) GetLayoutExceptionElement(Object) GetLayoutExceptionElement(Object) GetLayoutExceptionElement(Object)

Returns the element that was being processed by the layout system at the moment of an unhandled exception.

public : static UIElement GetLayoutExceptionElement(PlatForm::Object dispatcher)public static UIElement GetLayoutExceptionElement(Object dispatcher)Public Static Function GetLayoutExceptionElement(dispatcher As Object) As UIElement// This API is not available in Javascript.
Parameters
dispatcher
PlatForm::Object Object Object Object

The dispatcher object that defines the scope of the operation. Direct support for "Dispatcher" type does not exist yet.

Returns

The element being processed at the time of an unhandled exception.

GetLayoutSlot(FrameworkElement) GetLayoutSlot(FrameworkElement) GetLayoutSlot(FrameworkElement) GetLayoutSlot(FrameworkElement)

Returns the layout slot, or bounding box, that contains the specified element.

public : static Rect GetLayoutSlot(FrameworkElement element)public static Rect GetLayoutSlot(FrameworkElement element)Public Static Function GetLayoutSlot(element As FrameworkElement) As Rect// This API is not available in Javascript.
Parameters
element
FrameworkElement FrameworkElement FrameworkElement FrameworkElement

The element for which to return the layout slot.

Returns

The area assigned to the element for layout.