如何使PropertyGrid Collection Items半可编辑?

时间:2013-08-23 11:53:10

标签: c# propertygrid

我有一个名为BasePath的课程,其中包含DrivePathMetaName属性。 此外,我创建了一个BasePathCollection以在PropertyGrid(可扩展)中显示它们。

要添加路径,您必须单击"三个点按钮"在哪里可以获得另一个PropertyGrid,您可以在其中看到" BasePathCollection"的所有项目。在左边,项目属性在右边。

enter image description here

BasePath属性为[ReadOnly(true)]时,我可以通过点击另一个"三个点按钮"来编辑路径:

enter image description here

但是现在我需要让MetaName属性可编辑和繁荣,突然我无法编辑路径。 "三个点按钮"不再可访问:

enter image description here

我需要更改以获得"三个点按钮"还能够编辑MetaName属性吗?

编辑: 财产声明:

您的MetaName属性是如何声明的?请告诉我们一些代码。 - Simon Mourier 1小时前

    private string m_metaName;

    [Browsable(true)]
    [ReadOnly(true)]
    public string Drive { get { return m_drive; } set { m_drive = value; } }

    [Browsable(true)]
    [ReadOnly(true)]
    public string Path { get { Clear(); return m_path; } set { m_path = value; Clear(); } }

    [Browsable(true)]
    [ReadOnly(true)]
    public string MetaName { get { return m_metaName; } set { m_metaName = value; } }

是的,缺乏知识我尝试为BasePath-Class设置以下属性以使其可编辑。

[TypeConverter(typeof(BasePathConverter))]
[Editor(typeof(FolderNameEditorWithRootFolder), typeof(System.Drawing.Design.UITypeEditor))]
public class BasePath : IComparable<BasePath>{ ... }

0 个答案:

没有答案