Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在PropertyGrid的集合编辑器中更改类型名称_C#_.net_Winforms_Propertygrid - Fatal编程技术网

C# 在PropertyGrid的集合编辑器中更改类型名称

C# 在PropertyGrid的集合编辑器中更改类型名称,c#,.net,winforms,propertygrid,C#,.net,Winforms,Propertygrid,我在ManageConfig类中有一个属性 public class ManageConfig { [Category("Config")] [Description("Read and write specific")] [DisplayName("Camera Settings")] public List<Config> Configuration { get; set; } } public

我在ManageConfig类中有一个属性

public class ManageConfig
{
    [Category("Config")]
    [Description("Read and write specific")]
    [DisplayName("Camera Settings")]
    public List<Config> Configuration 
    {
        get;
        set;
    }
}

public class Config
{
    public string ConfigName { get;  set; }
    public string ConfigValue { get; set; }
}
public类ManageConfig
{
[类别(“配置”)]
[说明(“读写特定”)]
[显示名称(“摄像机设置”)]
公共列表配置
{
得到;
设置
}
}
公共类配置
{
公共字符串ConfigName{get;set;}
公共字符串配置值{get;set;}
}
当我在propertygrid I get窗口中打开集合时,我可以在其中添加或删除项,项名称是类名Config,我希望在更改每个项的ConfigName属性时更改项名称


感谢您可以重写
Config
类的
ToString
方法,以指定集合编辑器在项目列表的左面板中显示的内容:

public override string ToString()
{
    if(!string.IsNullOrEmpty(ConfigName))
        return ConfigName;
    return base.ToString();
}