Maybe the title is not so clear, but this is what I'm experiencing:
I have created a base-form which contains an OK and a Cancel button (which is called BaseOkCancelButtonForm) This form also has some properties which look like this:
[Browsable (true)] [Category ("Design")] [DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)] public string OkButtonText { get { return btnOk.Text; } set { btnOk.Text = value; } } [Browsable (true)] [Category ("Design")] [DefaultValue (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)] public bool OkButtonVisible { get { return btnOk.Visible; } set { btnOk.Visible = value; } }
[Browsable (true)] [Category ("Design")] [DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)] public string CancelButtonText { get { return btnCancel.Text; } set { btnCancel.Text = value; } } [Browsable (true)] [Category ("Design")] [DefaultValue (true)] [DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)] public bool CancelButtonVisible { get { return btnCancel.Visible; } set { btnCancel.Visible = value; } }
Now, this is what is happening: I create a new form which inherits from my BaseOkCancelButtonForm.
When I modify the CancelButtonText property of my inherited form, and I rebuild the project, everything is going as expected: the Text of the Cancel button remains as the text that i've set. However, when I do the same for the CancelButtonVisible property, things go wrong. When I set the CancelButtonVisible property to false, and I rebuild the project, then VS.NET resets the value of this property back to true. :?
For one reason or another, the changed value is not persisted by the designer ? Is this know behaviour ? Am I doing something wrong ?