Size Struct
Definition
Defines a size.
public struct Size
Constructors
| Name | Description |
|---|---|
| Size (2 overloads) | Initializes a new instance of the Avalonia.Size structure. |
Size overloads
Size Constructor
Initializes a new instance of the Avalonia.Size structure.
public Size(double width, double height)
Parameters
width double
The width.
height double
The height.
Size Constructor
Initializes a new instance of the Avalonia.Size structure.
public Size(System.Numerics.Vector2 vector2)
Parameters
vector2 System.Numerics.Vector2
The vector to take values from.
Methods
| Name | Description |
|---|---|
| Constrain | Constrains the size. |
| Deconstruct | No summary available. |
| Deflate | Deflates the size by a Avalonia.Thickness. |
| Equals (2 overloads) | Returns a boolean indicating whether the size is equal to the other given size (bitwise). |
| GetHashCode | Returns a hash code for a Avalonia.Size. |
| Inflate | Inflates the size by a Avalonia.Thickness. |
| NearlyEquals | Returns a boolean indicating whether the size is equal to the other given size (numerically). |
| Parse | Parses a Avalonia.Size string. |
| ToString | Returns the string representation of the size. |
| WithHeight | Returns a new Avalonia.Size with the same width and the specified height. |
| WithWidth | Returns a new Avalonia.Size with the same height and the specified width. |
Constrain Method
Constrains the size.
public Avalonia.Size Constrain(Avalonia.Size constraint)
Parameters
constraint Avalonia.Size
The size to constrain to.
Returns
The constrained size.
Deconstruct Method
public void Deconstruct(double& width, double& height)
Parameters
width double&
height double&
Deflate Method
Deflates the size by a Avalonia.Thickness.
public Avalonia.Size Deflate(Avalonia.Thickness thickness)
Parameters
thickness Avalonia.Thickness
The thickness.
Returns
The deflated size.
Remarks
The deflated size cannot be less than 0.
Equals overloads
Equals Method
Returns a boolean indicating whether the size is equal to the other given size (bitwise).
public bool Equals(Avalonia.Size other)
Parameters
other Avalonia.Size
The other size to test equality against.
Returns
bool
True if this size is equal to other; False otherwise.
Equals Method
Checks for equality between a size and an object.
public bool Equals(object obj)
Parameters
obj object
The object.
Returns
bool
True if obj is a size that equals the current size.
GetHashCode Method
Returns a hash code for a Avalonia.Size.
public int GetHashCode()
Returns
int
The hash code.
Inflate Method
Inflates the size by a Avalonia.Thickness.
public Avalonia.Size Inflate(Avalonia.Thickness thickness)
Parameters
thickness Avalonia.Thickness
The thickness.
Returns
The inflated size.
NearlyEquals Method
Returns a boolean indicating whether the size is equal to the other given size (numerically).
public bool NearlyEquals(Avalonia.Size other)
Parameters
other Avalonia.Size
The other size to test equality against.
Returns
bool
True if this size is equal to other; False otherwise.
Parse Method
Parses a Avalonia.Size string.
public Avalonia.Size Parse(string s)
Parameters
s string
The string.
Returns
The Avalonia.Size.
ToString Method
Returns the string representation of the size.
public string ToString()
Returns
string
The string representation of the size.
WithHeight Method
Returns a new Avalonia.Size with the same width and the specified height.
public Avalonia.Size WithHeight(double height)
Parameters
height double
The height.
Returns
The new Avalonia.Size.
WithWidth Method
Returns a new Avalonia.Size with the same height and the specified width.
public Avalonia.Size WithWidth(double width)
Parameters
width double
The width.
Returns
The new Avalonia.Size.
Properties
| Name | Description |
|---|---|
| AspectRatio | Gets the aspect ratio of the size. |
| Height | Gets the height. |
| Width | Gets the width. |
AspectRatio Property
Gets the aspect ratio of the size.
public double AspectRatio { get; set; }
Height Property
Gets the height.
public double Height { get; set; }
Width Property
Gets the width.
public double Width { get; set; }
Fields
| Name | Description |
|---|---|
| Infinity | A size representing infinity. |
Infinity Field
A size representing infinity.
public Avalonia.Size Infinity