This documentation is archived and is not being maintained.

Size Structure

Implements a structure that is used to describe the Size of an object.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

public struct Size : IFormattable
<object property="width,height"/>

XAML Values


A value greater than or equal to 0 that specifies the Width of the Size structure.


A value greater than or equal to 0 that specifies the Height of the Size structure.

Size is particularly useful because it describes both the Height and Width of an object. Size is used extensively by the layout system to arrange and measure elements.

The following example demonstrates how to use a Size structure in code.

protected override Size MeasureOverride(Size availableSize)
    Size panelDesiredSize = new Size();

    // Report that the panel requires the size of its child objects. 
    foreach (UIElement child in InternalChildren)
        panelDesiredSize = child.DesiredSize;

    return panelDesiredSize;

More Code

How to: Create an Elliptical Arc This example shows how to draw an elliptical arc. To create an elliptical arc, use the PathGeometry, PathFigure, and ArcSegment classes.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0