Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a property without subclassing
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00883926
Message ID:
00884080
Views:
11
Kevin,

>I'd like to be able to subclass the button item, because I want to add a few properties to it and maybe even set up an interface. However, the way the control's designer works, it appears that I'm 'locked in' to "DevComponents.DotNetBar.ButtonItem".
>
>In the form where I'm using the control, can I add a few properties, without subclassing?

You're in luck...

.NET has a technology known as "Extender Provider" that allows you to do just that. I used this technology for MM .NET menu bars. As in your case, I wanted to continue to use the Windows Forms menu designer, but I wanted to add two new properties to the menu bar, one for adding an image to a menu bar and another for specifying a unique ID for menu bar security.

I created an mmMenuExtender class which implemented the Extender Provider interface. When you drop this control on a form it "adds" two new properties to all menu items. In actuality, there are two collections inside the mmMenuExtender class that store the values of these two properties for all menu bars. Even better, is the fact that VS .NET is "in" on this trick. When you select a menu bar at design time, these two new properties appear in the Property Sheet!

For starters, check out the .NET Help Topics:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconimplementingextenderprovider.asp

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform