DefaultValueAttribute

D

Dulovits M.

I want a default value for this color property ( with
System.ComponentModel.DefaultValue ) but it doesnt work ..
any hints or ideas what ive done wrong ??

[System.ComponentModel.Category("Border")]
[System.ComponentModel.DefaultValue(typeof
System.Drawing.Color),"Yellow")]
[System.ComponentModel.Description("Color of the BorderGradient.")]

public System.Drawing.Color GradientColor
{
get ...
set ...
}

thx in advance

dulo
 
V

Vijaye Raji

The attribute is just a hint. It lets others understand about the default
value for the property - for example, the property grid will use the
DefaultValue attribute to let users reset it.

If you want your property to have an initial value, you need to explicitly
set it in the constructor.

HTH

-vJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top