Edit

Share via


AspectRatio Struct

Definition

The AspectRatio structure is used by the ConstrainedBox control to define a specific ratio to restrict its content.

[Windows.Foundation.Metadata.CreateFromString(MethodName="Microsoft.Toolkit.Uwp.UI.Controls.AspectRatio.ConvertToAspectRatio")]
public readonly struct AspectRatio
[<Windows.Foundation.Metadata.CreateFromString(MethodName="Microsoft.Toolkit.Uwp.UI.Controls.AspectRatio.ConvertToAspectRatio")>]
type AspectRatio = struct
Public Structure AspectRatio
Inheritance
AspectRatio
Attributes
Windows.Foundation.Metadata.CreateFromStringAttribute

Constructors

AspectRatio(Double, Double)

Initializes a new instance of the AspectRatio struct with the provided width and height.

AspectRatio(Double)

Initializes a new instance of the AspectRatio struct with the specific numerical aspect ratio.

Properties

Height

Gets the height component of the aspect ratio.

Value

Gets the raw numeriucal aspect ratio value itself (Width / Height).

Width

Gets the width component of the aspect ratio or the aspect ratio itself (and height will be 1).

Methods

ConvertToAspectRatio(String)

Converter to take a string aspect ration like "16:9" and convert it to an AspectRatio struct. Used automatically by XAML.

ToString()

Returns the fully qualified type name of this instance.

Operators

Implicit(AspectRatio to Double)

Implicit conversion operator to convert an AspectRatio to a Double value. This lets you use them easily in mathmatical expressions.

Implicit(Double to AspectRatio)

Implicit conversion operator to convert a Double to an AspectRatio value. This allows for x:Bind to bind to a double value.

Implicit(Int32 to AspectRatio)

Implicit conversion operator to convert a Int32 to an AspectRatio value. Creates a simple aspect ratio of N:1, where N is int

Applies to