LengthConverter
Converts numeric values and unit-suffixed strings to Spreadsheet pixel lengths.
Strings support
px,in,cm,pt, andAuto;Autois represented by NaN.
Definition
Namespace:Telerik.WinControls.Spreadsheet.UI
Assembly:Telerik.WinControls.RadSpreadsheet.dll
Syntax:
public class LengthConverter : TypeConverter
Inheritance: objectTypeConverterLengthConverter
Inherited Members
Constructors
Creates a converter for Spreadsheet lengths.
public LengthConverter()
Methods
Determines whether a value of the specified type can be converted to a length.
public override bool CanConvertFrom(ITypeDescriptorContext typeDescriptorContext, Type sourceType)
The conversion context.
sourceTypeTypeThe source type to check.
Returns:true for signed or unsigned 16-, 32-, and 64-bit integers, float, double, decimal, strings, and enums with one of those integer underlying types; otherwise, false.
Overrides:
Determines whether a length can be converted to the specified destination type.
public override bool CanConvertTo(ITypeDescriptorContext typeDescriptorContext, Type destinationType)
The conversion context.
destinationTypeTypeThe destination type to check.
Returns:true for strings and InstanceDescriptor; otherwise, false.
Overrides:
Converts a numeric value or unit-suffixed string to a pixel length.
public override object ConvertFrom(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object source)
The conversion context.
cultureInfoCultureInfoThe culture used to parse numeric text.
sourceobjectThe numeric value or a string containing a supported unit.
Returns:The length in pixels; the string Auto becomes NaN.
Overrides:
Converts a double-precision pixel length to a string or an instance descriptor.
public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType)
The conversion context.
cultureInfoCultureInfoThe culture used to format the numeric value.
valueobjectThe length value to convert.
destinationTypeTypeThe requested output type.
Returns:A culture-formatted numeric string, Auto for NaN, or an instance descriptor.
Overrides: