How do you stop the Designer generating code 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;
}

Leave a Comment