在propertyGrid c#中未显示ExpandableObjectConverter属性

本文关键字:显示 ExpandableObjectConverter 属性 propertyGrid | 更新日期: 2023-09-27 18:23:55

我创建了具有ExpandableObjectConverter类型的基类,它包含我需要在调用类中显示为可扩展的属性,以便在propertyGrid中显示,但它只在属性网格中显示类名,而不显示其下的属性

 [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public class SR1000
{
    [Description("Recieve Data Timeout")]
    public int Timeout { get; set; }
    [Description("Client IP Address")]
    [DisplayName("IP Address")]
    public string IpAddress { get; set; }
    [Description("Command and Data Port")]
    public int Port { get; set; }
    [Description("Bar Code Reader Postion")]
    public Point2D Poistion { get; set; }
 }

 [Serializable()]
[XmlRoot("BarCodeReader.BarCodeReader")]
public class BarCodeReader : ISystemDevice, IStationSpecificDevice
{
    [Category("SR1000")]
    public SR1000 SR1000 { get; set; }
}

知道我错过了什么吗

在propertyGrid c#中未显示ExpandableObjectConverter属性

我完全忘记创建属性对象的实例

 public BarCodeReader()
    {
        SR1000 = new SR1000();
    }