Control-Based Extender Providers

As stated previously, any component can serve as an Extender Provider. All that is necessary is to implement the IExtenderProvider interface, add the necessary ProvideProperty attributes, and implement the Get/Set methods for the property. Creating a control that implements the IExtenderProvider interface is the same as it was for the BorderPainterExtender sample described previously. To demonstrate this, the next Extender Provider will be derived from a Label control. In addition, this new Extender Provider will only extend MenuItems to provide a MenuItemHelpText property. Figure A.3 shows the completed MenuItemExtender displaying some help text for the selected MenuItem.

Figure A.3. A Label control implementing ...

Get .NET Windows® Forms Custom Controls now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.