Xamarin.Forms Guides | Samples

Xamarin.Forms.GridLengthTypeConverter Class

A TypeConverter that converts from strings to GridLengths.

See Also: GridLengthTypeConverter


public class GridLengthTypeConverter : TypeConverter


The following example shows some uses of GridLengthTypeConverter:

C# Example

			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*"));


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,

The members of Xamarin.Forms.GridLengthTypeConverter are listed below.

See Also: TypeConverter

Public Constructors

Creates a new GridLength object with default values.

Public Methods

CanConvertFrom(Type) : Boolean
Returns a Boolean value that indicates whether this GridLengthTypeConverter can convert the sourceType to a GridLength instance.
ConvertFrom(CultureInfo, Object) : Object
Converts value into a GridLength by using the specified culture.
ConvertFromInvariantString(String) : Object
Converts a valid grid length descriptor in to a GridLength.