Size Structure
TOC
Collapse the table of content
Expand the table of content

Size Structure

 

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

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

[SerializableAttribute]
[TypeConverterAttribute(typeof(SizeConverter))]
public struct Size : IFormattable

NameDescription
System_CAPS_pubmethodSize(Double, Double)

Initializes a new instance of the Size structure and assigns it an initial width and height.

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticEmpty

Gets a value that represents a static empty Size.

System_CAPS_pubpropertyHeight

Gets or sets the Height of this instance of Size.

System_CAPS_pubpropertyIsEmpty

Gets a value that indicates whether this instance of Size is Empty.

System_CAPS_pubpropertyWidth

Gets or sets the Width of this instance of Size.

NameDescription
System_CAPS_pubmethodEquals(Object)

Compares an object to an instance of Size for equality. (Overrides ValueType.Equals(Object).)

System_CAPS_pubmethodEquals(Size)

Compares a value to an instance of Size for equality.

System_CAPS_pubmethodSystem_CAPS_staticEquals(Size, Size)

Compares two instances of Size for equality.

System_CAPS_pubmethodGetHashCode()

Gets the hash code for this instance of Size. (Overrides ValueType.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticParse(String)

Returns an instance of Size from a converted String.

System_CAPS_pubmethodToString()

Returns a String that represents this Size object. (Overrides ValueType.ToString().)

System_CAPS_pubmethodToString(IFormatProvider)

Returns a String that represents this instance of Size.

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticEquality(Size, Size)

Compares two instances of Size for equality.

System_CAPS_puboperatorSystem_CAPS_staticExplicit(Size to Point)

Explicitly converts an instance of Size to an instance of Point.

System_CAPS_puboperatorSystem_CAPS_staticExplicit(Size to Vector)

Explicitly converts an instance of Size to an instance of Vector.

System_CAPS_puboperatorSystem_CAPS_staticInequality(Size, Size)

Compares two instances of Size for inequality.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIFormattable.ToString(String, IFormatProvider)

This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

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.

<object property="width,height"/>

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.

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

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

    // In our example, we just have one child. 
    // Report that our panel requires just the size of its only child.
    foreach (UIElement child in InternalChildren)
    {
        child.Measure(availableSize);
        panelDesiredSize = child.DesiredSize;
    }

    return panelDesiredSize ;
}

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

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

Return to top
Show:
© 2016 Microsoft