我正在尝试向自定义的UserControl
中添加一些字段。我希望这些字段在Visual Studio
的属性
窗口中可见。我尝试使用下面的标志,但即使编译后,在设计器中也看不到该字段。
应该如何正确地实现呢?
public partial class TosChartControl: UserControl
{
#region PUBLIC FIELDS
[Browsable(true)] //Added this but still does not show up
[Category("Data")]
[DefaultValue(0)]
[Description("ID of the Sensor Node")]
public int NodeId { get; set; }
#endregion
public TosChartControl()
{
InitializeComponent();
}
}
我已经清理并重新构建了解决方案和项目,但是我仍然无法在属性窗口中看到这个字段。即使重新启动Visual Studio也没有帮助。
NodeId
会出现在属性窗口中吗?如果它带有 get/set 属性,我猜它应该会出现。 - Sandy