你如何停止发电设计师code对用户控件的公共属性? [英] How do you stop the Designer generating code for public properties on a User Control?

查看:77
本文介绍了你如何停止发电设计师code对用户控件的公共属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能不让自动生成code,设置在用户控制的公共属性值的设计师?

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

推荐答案

使用的DesignerSerializationVisibilityAttribute上要由设计师序列化和隐藏的参数设置为隐藏属性。

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;
}

这篇关于你如何停止发电设计师code对用户控件的公共属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆