gpt4 book ai didi

c# - 属性网格中的列表扩展器,带有通用 ICustomTypeDescriptor

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:18 25 4
gpt4 key购买 nike

我有一个实现接口(interface)的通用类 (Parameters.cs):ICustomTypeDescriptor

我将泛型类用于几个不同的类,其中之一是:

    private Parameters<Class1> _class1Parameters;

public Parameters<Class1> Class1Parameters
{
get { return _class1Parameters; }
set { _class1Parameters= value; }
}

Class1.cs:

public class Class1
{
private List<Position> _pos = new List<Position>();

public List<Position> Pos
{
get { return _pos ; }
set { _pos = value; }
}

//Other variables
}

职位类别:

public class Position
{
public string Name { get; set; }
public double Position { get; set; }
}

现在列表在 Propertygrid ("...") 中显示为三个点。

我想用Expander("+")显示,如何通过ICustomTypeDescriptor实现?

编辑:

我尝试将 [TypeConverter(typeof(ExpandableObjectConverter))] 放在 Pos 列表上,但没有帮助。

最佳答案

最后我成功通过了这个网站:

Customized display of collection data in a PropertyGrid

关于c# - 属性网格中的列表扩展器,带有通用 ICustomTypeDescriptor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15895317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com