Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protected Properties - How to make them visible in designer?

Status
Not open for further replies.

keyser456

IS-IT--Management
Nov 21, 2003
73
US
I have a control "template" (I'll call UserControlTemplate) that I inherit as the base type for several other similar controls, like below:

public class UserControl1 : UserControlTemplate
{...}
public class UserControl2 : UserControlTemplate
{...}

My problem is I need to allow access to a UserControlTemplate property I'll call UserProperty1, but I only want it to be visible to classes that inherit UserControlTemplate such as UserControl1 and UserControl2, but I also want the property to show up in the IDE's property window while designing the new controls that inherit the template.

If I use the following:

protected string UserProperty1
{
get{...}
set{...}
}

This property does not show up in the designer under the properties window. I don't want to set the property to public because I don't want it to be changed anytime other than when designing the inherited control. I did some reading on custom designers and shadowing, and after trying a few things, the property still does not show up in the IDE property window when I'm designing the inherited control. The property only shows up when I place the inherited control on a form and select the inherited control, but that's not what I'm after.
 
In case the reason nobody has answered is because they don't want to take the time to read all that here is the short version:

I need a property to be visible in the designer's properties window, but it can't be public because I don't want outsiders (anything that doesn't inherit from the base class) to be able to access it.

Ultra short version:
How do you get protected properties to become visible in the designer's properties window?

Yes, I understand the properties window is an "external viewer", so I think either this can't be done or you'd have to trick the designer somehow.

Any advice appreciated. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top