User Control Property Designer Properties

Question :

User Control Property Designer Properties,

Answer :

For a C# UserControl on Windows Mobile (though please answer if you know it for full Windows…it might work) how do you change what shows up in the Designer Properties window for one of the Control’s public Properties. For example:

private Color blah = Color.Black;    public Color Blah  {      get { return this.blah; }      set { this.blah = value; }  }  

This shows up for the control, but it’s in the “Misc” category and has no description or default value. I’ve tried using the settings in System.ComponentModel like “DesignerCategory”, such as:

[DesignerCategory("Custom")]  

But says this is only valid for class declarations… could’ve sworn it was the System.ComponentModel items I used before…

Read More  Anyone know of an on-line free database?

Update:

@John said:

DesignerCatogy is used to say if the
class is a form, component etc.

Try this:

[Category(“Custom”)]

Is there a particular namespace I need to use in order to get those?
I’ve tried those exactly and the compiler doesn’t recognize them.

In .NETCF all I seem to have available from System.ComponentModel is:

DataObject,  DataObjectMethod,  DefaultValue,  DesignerCategory,  DesignTimeVisible,  EditorBrowsable  

The only one it doesn’t scream at is EditorBrowsable

,

DesignerCategory is used to say if the class is a form, component etc.

For full windows the attribute you want is:

[System.ComponentModel.Category("Custom")]  

and for the description you can use [System.ComponentModel.Description("This is the description")]

To use both together:

[System.ComponentModel.Category("Custom"),System.ComponentModel.Description("This is the description")]  

However this is part of system.dll which may be different for windows mobile.

Read More  Looking for best practice for doing a “Net Use” in C#

That’s the answer User Control Property Designer Properties, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you