Share via


GridLengthTypeConverter Class

Definition

A TypeConverter that converts from strings to GridLengths.

[Xamarin.Forms.Xaml.TypeConversion(typeof(Xamarin.Forms.GridLength))]
public class GridLengthTypeConverter : Xamarin.Forms.TypeConverter
type GridLengthTypeConverter = class
    inherit TypeConverter
Inheritance
System.Object
GridLengthTypeConverter
Attributes

Remarks

The following example shows some uses of GridLengthTypeConverter:

var converter = new GridLengthTypeConverter ();

Assert.AreEqual (new GridLength (42), converter.ConvertFrom ("42"));
Assert.AreEqual (new GridLength (42.2), converter.ConvertFrom ("42.2"));
Assert.AreEqual (GridLength.Auto, converter.ConvertFrom ("auto"));
Assert.AreEqual (GridLength.Auto, converter.ConvertFrom (" AuTo "));
Assert.AreEqual (new GridLength (1, GridUnitType.Star), converter.ConvertFrom ("*"));
Assert.AreEqual (new GridLength (42, GridUnitType.Star), converter.ConvertFrom ("42*"));

Constructors

GridLengthTypeConverter()

Creates a new GridLength object with default values.

Methods

CanConvertFrom(Type)

When implemented in a derived class, returns a Boolean value that indicates whether or not the derived type converter can convert sourceType to its target type.

(Inherited from TypeConverter)
ConvertFrom(CultureInfo, Object)
Obsolete.

When implemented in a derived class, converts an object that is a version of value and that can be cast to the target type.

(Inherited from TypeConverter)
ConvertFrom(Object)
Obsolete.

Calls ConvertFrom(CultureInfo, Object) with the current culture information and o.

(Inherited from TypeConverter)
ConvertFromInvariantString(String)

Converts a valid grid length descriptor in to a GridLength.

Applies to