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)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

'Declaration
<SerializableAttribute> _
<TypeConverterAttribute(GetType(SizeConverter))> _
Public Structure Size _
	Implements IFormattable
'Usage
Dim instance As Size
<object property="width,height"/>

XAML Values

width

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

height

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 Overrides Function MeasureOverride(ByVal availableSize As System.Windows.Size) As System.Windows.Size

    Dim panelDesiredSize As New Size()

    For Each child As UIElement In InternalChildren
        child.Measure(availableSize)
        panelDesiredSize = child.DesiredSize
    Next 

    Return panelDesiredSize

End Function

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
Show: