Prev | Current Page 696 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

Type converters are the subject of the next section.
538 CHAPTER 11 ?–  DESIGN-TIME SU PPORT
Type Converters
Type converter attributes are applied to type class definitions to assist with converting the type
to other data types and vice versa. Generally, this conversion is to/from the string type. Type
converters can also alter how a type appears in the property browser at design time.
?– Note Never access a type converter directly. Instead, access the appropriate converter by using
TypeDescriptor.
A custom type converter derives from System.ComponentModel.TypeConverter regardless of
whether it is for a property of a Windows Forms or web forms control. The type converter for
the Location class type has a type converter named LocationConverter that inherits from this
class. The purpose of this type converter is to alter how the Location type displays in the property
browser.
The LocationConverter Class
The Location class stores a latitude and longitude. An instance of this type is part of the
ImageMetaData type. The ImageMetaData type uses the Location instance to store the location
where the photo displayed by the TitledThumbnail control was taken. Latitude and longitude
values are generally displayed using degrees/minutes/seconds notation or as a decimal with
N/S, E/W appended to the decimal value.


Pages:
684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708