Xamarin.Forms Guides | Samples

Xamarin.Forms.GridLengthTypeConverter Class

A TypeConverter that converts from strings to GridLengths.

See Also: GridLengthTypeConverter

Syntax

public class GridLengthTypeConverter : TypeConverter

Remarks

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

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0

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

See Also: TypeConverter

Public Constructors

Creates a new GridLength object with default values.

Public Methods

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