Solved

How to change the ComponentModel.Category for an existing property without changing anything else?

Posted on 2008-10-24
4
264 Views
Last Modified: 2012-05-05
Hello,

I know one can use the ComponentModel.Category to set a category for a custom property. But how do I change the category for an existing propery without changing anything else of that property?

example: I want to change the property 'Enabled' from Behavior to Appearance.

How do I accomplish this?

Thank you!
0
Comment
Question by:Onthrax
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 22803080
I don't know why you would want to do that, but you might be able to create a custom class, and inherit from a class, and then override the property, but use the base implementation, and add the attribute that you wish to use.
0
 
LVL 13

Author Comment

by:Onthrax
ID: 22948259
How does one add base implementation to a property when overriding the property?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 22949463
Simple example:


public class ListControl : ListBox

{
 

    [Category("Appearance")]

    public override bool Enabled

    {

        get { return base.Enabled; }

        set { base.Enabled = value; }

    }

}

Open in new window

0
 
LVL 13

Author Comment

by:Onthrax
ID: 22983322
Working like a charm! Cheers m8!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now