The DefaultValue attribute is simply metadata that is used at design-time to
decide if the value of a property needs to be serialized. In other words, if
the value has not changed from the default then the value should not be
serialized. You'll need to make sure that the actual value of the field
storing the property value is the same as the value specified in the
DefaultValue attribute.
private int count = 2;
[DefaultValue(2)]
public int ButtonCount
{
get{ return count;}
set{ count = value;}
}

Signature
Tim Wilson
.NET Compact Framework MVP
> My custom composite control for the .NET Compact Framework will not serialize
> the DesignTime DefaultValues I assign to properties. For instance, VS
[quoted text clipped - 13 lines]
>
> Considering the code snippet above you'd think the designer would
serialize
> the following.
>
[quoted text clipped - 7 lines]
> I can change the value of the property and the code reflects the change
> correctly, but the designer doesn't initially serialize the default value
to
> the property in InitializeComponents. Consequently, when I change the
> property value manually via the property grid to the default value, the
[quoted text clipped - 20 lines]
> initially, and disregards the DefaultValue. Consequently, when the default
> value is selected manually the default value isn't recognized by the
designer
> and the default value setting is still serialized in InitializeComponents.
> This differs from the 'int' property above.
[quoted text clipped - 5 lines]
>
> thanks