设置一个用户控件属性不会出现在VS性窗口
-
09-06-2019 - |
题
我有一个用户控件在我的Asp.net 项目的有公共财产。我不想要这个酒店,以显示在Visual Studio酒店的窗口,当一个用户重点的一个实例,用户控件在IDE。什么样的属性(或其他方法)应使用以防止它显示出来的?
class MyControl : System.Web.UI.UserControl {
// Attribute to prevent property from showing in VS Property Window?
public bool SampleProperty { get; set; }
// other stuff
}
解决方案
使用下列属性...
using System.ComponentModel;
[Browsable(false)]
public bool SampleProperty { get; set; }
在VB.net这 将:
<System.ComponentModel.Browsable(False)>
其他提示
吨的属性 有控制如何PropertyGrid工作。
[Browsable(false)]
public bool HiddenProperty {get;set;}
使用 System.ComponentModel.Browsable
属性
> ' VB
>
> <System.ComponentModel.Browsable(False)>
或
// C#
[System.ComponentModel.Browsable(false)]
不隶属于 StackOverflow