Struct LengthPercentageOrNumber
public struct LengthPercentageOrNumber
- Inherited Members
Constructors
LengthPercentageOrNumber(double, LengthContext)
Represents a length that may have a value that is context dependent.
public LengthPercentageOrNumber(double value, LengthContext context)
Parameters
valuedoubleThe numerical part of the length that is related to the
contextcontextLengthContextIf null, units will be ignored
Properties
Value
Represents a length, percentage, or number value that has been resolved based on the context.
public double Value { get; }
Property Value
Methods
Parse(Shape, string, LengthOrientation)
Parses a string representation of a length, percentage, or number value into a LengthPercentageOrNumber instance.
public static LengthPercentageOrNumber Parse(Shape owner, string value, LengthOrientation orientation = LengthOrientation.None)
Parameters
ownerShapeThe element that the length is associated with.
valuestringA string representation of a length
orientationLengthOrientationUsed to establish the context of the length. Should be Horizontal for inherntly horizontal values like 'x' and 'dx'. Should be Vertical for inherntly vertical values like 'y' and 'dy'. Should be None for other values.
Returns
- LengthPercentageOrNumber
A LengthPercentageOrNumber instance that represents the parsed value.
Exceptions
- ArgumentException
Thrown when the provided value is not a valid length, percentage, or number.