Size Size Size Struct

Definition

Represents number values that specify a height and width.

public : struct Sizepublic struct SizePublic Structure Size
<object property="width,height"/>
-or-
<object property="width height"/>
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)

Remarks

When applied to properties that represent UI information, the width and height values of a Size value represent device-independent pixels.

JavaScript In JavaScript, a Size is an object with 2 data properties: width and height. The API listed in the Size member lists don't apply to JavaScript programming.

Notes on XAML syntax

The only Windows Runtime property that uses a Size as a value for XAML is ArcSegment.Size. Rect is more common.

Object attribute usage is technically permitted by the Windows Runtime XAML parsing rules. However, that usage isn't shown in syntax because it's not common. A Size can't be used as a XAML resource (for more info see ResourceDictionary and XAML resource references).

You can use a space rather than a comma as the delimiter between values.

Projection and members of Size

If you are using a Microsoft .NET language (C# or Microsoft Visual Basic), or Visual C++ component extensions (C++/CX), then Size has non-data members available, and its data members are exposed as read-write properties, not fields. Microsoft .NET supports this functionality through the System.Runtime.WindowsRuntime.dll interop assembly that's shipped as part of .NET for Windows Runtime app. Visual C++ component extensions (C++/CX) supports it through the language-specific platform.winmd metadata and the runtime behavior it represents.

If you are programming with C++ using the Windows Runtime Template Library (WRL), then only the data member fields exist as members of Size, and you cannot use the utility methods or properties listed in the members table. WRL code can access similar utility methods that are available from the SizeHelper static class. For more info on WRL, see WRL Integration.

Fields

Height Height Height

The height.

public : field float Heightpublic field float HeightPublic Field Height
Attributes

Width Width Width

The width.

public : field float Widthpublic field float WidthPublic Field Width
Attributes