I have a user control with custom properties as follows:
[DefaultValue(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Description("Gets or sets whether the \"Remove\" button is visible.")]
public bool ShowRemoveButton
{
get
{
return this.removeButton.Visible;
}
set
{
this.removeButton.Visible = value;
}
}
The control contains a standard button control. This property is used to show or hide the button. The user control is built in a separate project assembly. I placed it on a form and I can set and unset the above property and everything appears to be working just fine. However, when the project containing the user control is rebuilt, the property value flips to "false", which is not the default.
How can I prevent the custom property from losing/altering its state when the control is rebuilt?