Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you stop the Designer generating code for public properties on a User Control?

Tags:

c#

winforms

How do you stop the designer from auto generating code that sets the value for public properties on a user control?

like image 850
John Hunter Avatar asked Aug 27 '08 07:08

John Hunter


2 Answers

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; } 
like image 175
Erik Hellström Avatar answered Sep 23 '22 04:09

Erik Hellström


Add the following attributes to the property in your control:

[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] 
like image 34
Will Dean Avatar answered Sep 20 '22 04:09

Will Dean