New to Telerik UI for .NET MAUIStart a free 30-day trial

Represents a unit of measurement.

Definition

Namespace:Telerik.Maui.Controls.RichTextEditor

Assembly:Telerik.Maui.Controls.dll

Syntax:

C#
[TypeConverter(typeof(RichTextUnitTypeConverter))]
public struct RichTextUnit : IComparable<RichTextUnit>, IEquatable<RichTextUnit>

Implements: IComparable<RichTextUnit>IEquatable<RichTextUnit>

Constructors

Initializes a new instance of the RichTextUnit with the specified value and type.

C#
public RichTextUnit(double value, RichTextUnitType type)
Parameters:valuedouble

Specifies the value of the measurement unit.

typeRichTextUnitType

Specifies the type of the measurement unit.

Initializes a new instance of the RichTextUnit with the specified value in pixels.

C#
public RichTextUnit(double value)
Parameters:valuedouble

Specifies the value of the measurement unit in pixels.

Properties

Gets the type of the measurement unit type.

C#
public readonly RichTextUnitType Type { get; }

Gets the value of the measurement unit type.

C#
public readonly double Value { get; }

Methods

Compares the current RichTextUnit with the specified one.

C#
public int CompareTo(RichTextUnit unit)
Parameters:unitRichTextUnit

Specifies the RichTextUnit to compare to.

Returns:

int

0 - if the current RichTextUnit is equal to the specified one; 1 - if the current RichTextUnit is greater than the specified one; -1 - if the current RichTextUnit is less than the specified one;

Implements: IComparable<RichTextUnit>.CompareTo(RichTextUnit)

Determines if the current RichTextUnit is equal to the specified object.

C#
public override bool Equals(object other)
Parameters:otherobject

Specifies the object to compare to.

Returns:

bool

True - if the two objects are equal, False - otherwise.

Overrides: ValueType.Equals(object)

Determines if the current RichTextUnit is equal to the specified one.

C#
public bool Equals(RichTextUnit unit)
Parameters:unitRichTextUnit

Specifies the RichTextUnit to compare to.

Returns:

bool

True - if the current RichTextUnit is equal to the specified one, False - otherwise.

Implements: IEquatable<RichTextUnit>.Equals(RichTextUnit)

Computes the hash code of the current RichTextUnit.

C#
public override int GetHashCode()
Returns:

int

The computed hash code of the current RichTextUnit.

Overrides: ValueType.GetHashCode()

Parses the specified string to a RichTextUnit.

C#
public static RichTextUnit Parse(string text)
Parameters:textstring

Specifies the string to parse to.

Returns:

RichTextUnit

The parsed RichTextUnit.

Exceptions:

FormatException

If the specified string is not in a valid format.

Converts the current RichTextUnit to its string representation.

C#
public override string ToString()
Returns:

string

The string representation of the current RichTextUnit.

Overrides: ValueType.ToString()

Converts the current RichTextUnit to the specified type.

C#
public RichTextUnit ToUnit(RichTextUnitType type)
Parameters:typeRichTextUnitType

Specifies the RichTextUnitType to convert to.

Returns:

RichTextUnit

The new RichTextUnit with the specified RichTextUnitType.

Attempts to parse the specified string to a RichTextUnit.

C#
public static bool TryParse(string text, out RichTextUnit unit)
Parameters:textstring

Specifies the string to parse to.

unitRichTextUnit

Outputs the parsed RichTextUnit.

Returns:

bool

True - if the parse operation is successful, False - otherwise.

Operators

Converts the specified RichTextUnit to pixels.

C#
public static explicit operator double(RichTextUnit unit)
Parameters:unitRichTextUnit

Specifies the RichTextUnit to convert to.

Returns:

double

Converts the specified value in pixels to RichTextUnit.

C#
public static implicit operator RichTextUnit(double value)
Parameters:valuedouble

Specifies the value in pixels to convert to.

Returns:

RichTextUnit

Converts the specified string to a RichTextUnit.

C#
public static implicit operator RichTextUnit(string text)
Parameters:textstring

Specifies the string to convert to.

Returns:

RichTextUnit

Compares the two operands for inequality.

C#
public static bool operator !=(RichTextUnit left, RichTextUnit right)
Parameters:leftRichTextUnit

Specifies the left operand of the comparison.

rightRichTextUnit

Specifies the right operand of the comparison.

Returns:

bool

True - if the two operands are not equal, False - otherwise.

Determines if the left operand is less than the right operand.

C#
public static bool operator <(RichTextUnit left, RichTextUnit right)
Parameters:leftRichTextUnit

Specifies the left operand of the comparison.

rightRichTextUnit

Specifies the right operand of the comparison.

Returns:

bool

True - if the left operand is less than the right operand, False - otherwise.

Determines if the left operand is less or equal the right operand.

C#
public static bool operator <=(RichTextUnit left, RichTextUnit right)
Parameters:leftRichTextUnit

Specifies the left operand of the comparison.

rightRichTextUnit

Specifies the right operand of the comparison.

Returns:

bool

True - if the left operand is less or equal the right operand, False - otherwise.

Compares the two operands for equality.

C#
public static bool operator ==(RichTextUnit left, RichTextUnit right)
Parameters:leftRichTextUnit

Specifies the left operand of the comparison.

rightRichTextUnit

Specifies the right operand of the comparison.

Returns:

bool

True - if the two operands are equal, False - otherwise.

Determines if the left operand is greater than the right operand.

C#
public static bool operator >(RichTextUnit left, RichTextUnit right)
Parameters:leftRichTextUnit

Specifies the left operand of the comparison.

rightRichTextUnit

Specifies the right operand of the comparison.

Returns:

bool

True - if the left operand is greater than the right operand, False - otherwise.

Determines if the left operand is greater or equal the right operand.

C#
public static bool operator >=(RichTextUnit left, RichTextUnit right)
Parameters:leftRichTextUnit

Specifies the left operand of the comparison.

rightRichTextUnit

Specifies the right operand of the comparison.

Returns:

bool

True - if the left operand is greater or equal the right operand, False - otherwise.