DefaultValueAttribute

  • Thread starter Thread starter Dulovits M.
  • Start date Start date
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
 
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
 
Back
Top