Specifies what type to use as a converter for the object this attribute is bound to.
Assembly: System (in System.dll)
Initializes a new instance of theclass with the default type converter, which is an empty string ("").
Initializes a new instance of theclass, using the specified type name as the data converter for the object this attribute is bound to.
Initializes a new instance of theclass, using the specified type as the data converter for the object this attribute is bound to.
Returns whether the value of the given object is equal to the current Attribute.Equals(Object).).(Overrides
Returns the hash code for this instance.(Overrides Attribute.GetHashCode().)
When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.(Inherited from Attribute.)
When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.(Inherited from Attribute.)
Returns a string that represents the current object.(Inherited from Object.)
Specifies the type to use as a converter for the object this attribute is bound to.
|_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)|
Maps a set of names to a corresponding set of dispatch identifiers.(Inherited from Attribute.)
|_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)|
Retrieves the type information for an object, which can be used to get the type information for an interface.(Inherited from Attribute.)
Retrieves the number of type information interfaces that an object provides (either 0 or 1).(Inherited from Attribute.)
|_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)|
Provides access to properties and methods exposed by an object.(Inherited from Attribute.)
The class you use for conversion must inherit from TypeConverter. Use the ConverterTypeName property to get the name of the class that provides the data conversion for the object this attribute is bound to.
In order to establish a type converter on a custom class that provides type conversion behavior for XAML, you apply the TypeConverters and XAML.attribute to your type. The argument of the attribute references your type converter implementation. Your type converter should be able to accept values from a string that is used for attributes or initialization text in XAML markup, and convert that string into your intended destination type. For more information, see
Rather than applying to all values of a type, a type converter behavior for XAML can also be established on a specific property. In this case, you applyto the property definition (the outer definition, not the specific get and set definitions).
A type converter behavior for XAML usage of a custom attachable member can be assigned by applying Attached Properties Overview.to the get method accessor that supports the XAML usage. For more information, see
For complex XAML serialization cases that require additional state from the object runtime, consider defining a value serializer in addition to a type converter, and attribute both support classes on your custom types or custom members. For more information, see ValueSerializer.
The following example declares MyClass to use the type converter called MyClassConverter. This example assumes that MyClassConverter has been implemented elsewhere. The class implementing the converter (MyClassConverter) must inherit from the TypeConverter class.
<TypeConverter(GetType(MyClassConverter))> _ Public Class ClassA ' Insert code here. End Class 'MyClass
The next example creates an instance of MyClass. Then it gets the attributes for the class, and prints the name of the type converter used by MyClass.
Public Shared Function Main() As Integer ' Creates a new instance of ClassA. Dim myNewClass As New ClassA() ' Gets the attributes for the instance. Dim attributes As AttributeCollection = TypeDescriptor.GetAttributes(myNewClass) ' Prints the name of the type converter by retrieving the ' TypeConverterAttribute from the AttributeCollection. Dim myAttribute As TypeConverterAttribute = _ CType(attributes(GetType(TypeConverterAttribute)), TypeConverterAttribute) Console.WriteLine(("The type conveter for this class is: " _ + myAttribute.ConverterTypeName)) Return 0 End Function 'Main
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.