-api-id | -api-type |
---|---|
T:Windows.Foundation.Size |
winrt struct |
Represents number values that specify a height and width.
<object property="width,height"/>
-or-
<object property="width height"/>
- width
- widthA numeric value greater than or equal to 0 that specifies the Width component of the Size structure.
- height
- heightA numeric value greater than or equal to 0 that specifies the Height of the Size structure.
The width.
The height.
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.
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.
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. See Size in the .NET API Browser.
If you are programming with C++/WinRT or the Windows Runtime C++ Template Library (WRL), then only the data member fields exist as members of Size, and you cannot use the utility methods or properties of the .NET projection. C++ code can access similar utility methods that are available from the SizeHelper static class.
This table shows the equivalent methods available in .NET and C++.
.NET (Size) | C++ (SizeHelper) |
---|---|
Size(Double, Double) | FromDimensions(Single, Single) |
Empty | Empty |
IsEmpty | GetIsEmpty(Size) |
Equals | Equals(Size, Size) |