How do you stop the designer from auto generating code that sets the value for public properties on a user control?
Use the DesignerSerializationVisibilityAttribute on the properties that you want to hide from the designer serialization and set the parameter to Hidden.
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string Name { get; set; }
Add the following attributes to the property in your control:
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With