我有一个用户控件在我的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)]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top