Guys hi there))
pleace tell me - Is this default attribute correct (it doesn't work in my costom control) -

[Bindable(true), Category("BrushOptions"), Description("end color"), DefaultValue(typeof(Color), "White")]
            public Color EndColor
            {
                get { return endColor; }
                set { endColor = value; OnChangeProperties(); }
            }

thanks in advance))

If you are having problems a good idea is always to step back and try and isolate the it. Initialize the property in the constructor to see if that is the problem.

Comments
+++++++++

[DefaultValue("Color.White")]

thit doesn't work too.

[DefaultValue("Color.Red")]
            public Color MainColor
            {
                get { return mainColor; }
                set { mainColor = value; OnChangeProperties(); }
            }

Edited 5 Years Ago by vedro-compota: n/a

i see ..

but one workaround can be done like this:
when you declar the start,end colors , give them the Default color values.
like

private Color startColor = Color.Green;
private Color endColor = Color.Blue;
private Color mainColor = Color.Red;

this colors will act as defaults.. i have tested and it's working fine..

Comments
++++++++

DefaultValue attribute does not set the initial value of property. The VS designer will display this value as non-bold (defaultValue) and other values as bold (which are modified), but still you have to set the value of this property.

This question has already been answered. Start a new discussion instead.