Class DateTimeTypeConverter
Provides a converter to convert System.DateTime objects to and from other representations.
Inheritance
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.dll
Syntax
public class DateTimeTypeConverter : TypeConverter
Constructors
| Improve this Doc View SourceDateTimeTypeConverter()
Initializes a new instance of the DateTimeTypeConverter class.
Declaration
public DateTimeTypeConverter()
Methods
| Improve this Doc View SourceCanConvertFrom(ITypeDescriptorContext, Type)
Gets a value indicating whether it is possible to convert the specified type to a System.DateTime with the specified format context.
Declaration
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.ITypeDescriptorContext | context | The format context that is used to convert the specified type. |
System.Type | sourceType | The type to convert. |
Returns
Type | Description |
---|---|
System.Boolean | True if the conversion is possible; otherwise, false. |
Overrides
CanConvertTo(ITypeDescriptorContext, Type)
Gets a value indicating whether it is possible to convert a System.DateTime to the specified type within the specified format context.
Declaration
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.ITypeDescriptorContext | context | The format context that is used to convert. |
System.Type | destinationType | The type to convert to. |
Returns
Type | Description |
---|---|
System.Boolean | True if the conversion is possible; otherwise, false. |
Overrides
ConvertFrom(ITypeDescriptorContext, CultureInfo, Object)
Converts the specified object to a System.DateTime with the specified culture with the specified format context.
Declaration
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.ITypeDescriptorContext | context | The format context that is used to convert the specified type. |
System.Globalization.CultureInfo | culture | The culture to use for the result. |
System.Object | value | The value to convert. |
Returns
Type | Description |
---|---|
System.Object | A System.DateTime object that represents |
Overrides
Exceptions
Type | Condition |
---|---|
System.FormatException | The conversion cannot be performed. |
System.ArgumentNullException | The culture is null. |
System.ArgumentNullException | The value is null. |
ConvertTo(ITypeDescriptorContext, CultureInfo, Object, Type)
Converts a System.DateTime with the specified culture to the specified object with the specified format context.
Declaration
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.ITypeDescriptorContext | context | The format context that is used to convert to the specified type. |
System.Globalization.CultureInfo | culture | The culture to use for the converting date. |
System.Object | value | The date to convert. |
System.Type | destinationType | The type to convert to. |
Returns
Type | Description |
---|---|
System.Object | An object of the specified type that represents |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The culture is a null reference (Nothing in Visual Basic). |
System.ArgumentNullException | The destinationType is a null reference (Nothing in Visual Basic). |
System.NotSupportedException | The value is not a DateTime or the destinationType is not a string. |