Prev | Current Page 691 | Next

Rob Cameron and Dale Michalk

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

We
discuss customizations for the Properties window in the next section.
CHAPTER 11 ?–  DES IGN-TIME S UPPORT 533
Figure 11-2. The TitledThumbnail control in the Visual Studio Designer
The Properties Window
Without any work by the developer, a control that inherits from System.Web.UI.Control displays
simple properties in the property browser. Simple properties include Boolean, string, integer,
decimal, and so on. Although not a simple type, enumeration types also display automatically,
as does a drop-down list in the property browser.
Some easy customizations include applying the basic design-time attributes listed in
Chapter 3. Here is an example from the TitledThumbnail control:
[DescriptionAttribute("Set the alignment for the Image and Title."),
CategoryAttribute("Layout"),DefaultValue("center")]
The DescriptionAttribute displays the passed-in string at the bottom of the property
browser, as pointed out by item 4 in Figure 11-2. The CategoryAttribute places the property
in the passed-in category in the Properties window. Example property browser categories are
Layout, Behavior, and so on. The last attribute, DefaultValue, sets the default value for the property.
For an enumeration property, set the DefaultValue property to a string value representing the
enumeration value, not the actual strongly typed enumeration value.


Pages:
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703