Solved

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

Posted on 2008-10-24
4
266 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

778 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