如何在设计器的“集合编辑器Windows”中创建可编辑对象?

圭多

我创建了一个自TDataSet派生的自定义组件。
现在,我从dsTable名为的自定义类型创建了一个集合gttTables(所有代码都在下面)

当我将组件放到窗体上时,集合将gttTables显示在中,property window并且当我单击3dotted按钮时,Collection Editor Windows将按预期出现。
在中,Collection Editor Windows我可以单击Add,这将在窗口中添加一个新项目,该项目似乎是dsTable我所期望的类型

现在解决问题。
在中,Collection Editor Windows我无法看到/更改dsTable左侧列表中每个属性的任何属性右侧仅显示Value值为gttControls.dsTable
让我告诉你这张照片的意思

在此处输入图片说明

我希望看到每个属性都dsTable添加到Collection Editor Windows此处,因此我可以对其进行编辑。

这是我完整的代码。
我的问题是我应该怎么做,以便我可以编辑添加dsTable到其中的每个属性Collection Editor Windows

public partial class gttDataSet : DataSet
{
    Collection<dsTable> _dsTables = new Collection<dsTable>();

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    [Editor("System.ComponentModel.Design.CollectionEditor, System.Design", typeof(UITypeEditor))]
    [Category("GTT")]
    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    public Collection<dsTable> gttTables
    {
        get { return _dsTables; }
        set { _dsTables = value; }
    }
}

public class dsTable
{
    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
    string SelectText { get; set; }

    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
    string SelectTextForUpdate { get; set; }

    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
    string DesignWhereText { get; set; }

    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
    string UserWhereText { get; set; }

    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    bool IsStoredProcedure { get; set; }

    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    bool RetrieveColumns { get;  }
}

编辑
我看了看如何创建与属性网格一起使用的自定义集合编辑器表单?尽管它包含有用的信息,但对于我来说似乎没有必要。@Serg的答案解决了我的问题

塞格

您应该使您的dsTable类属性public能够使用以下命令编辑这些属性PropertyGrid

public class dsTable
{
    [Browsable(true)]
    [EditorBrowsable(EditorBrowsableState.Always)]
    [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
    public string SelectText { get; set; } // <--- changed here

    //make the same changes for other properties you want to edit.
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Umbraco中创建编辑器可编辑侧栏?

如何在Android中创建可编辑微调器

您如何自定义集合编辑器的标题?

如何在Atom编辑器中编辑核心文件

如何在 godot 编辑器中编辑矢量类?

如何在内容可编辑的编辑器上停止扩展/添加文法

如何在jhtmlarea编辑器中使节不可编辑

Shopify:如何使自定义模板在主题编辑器中可编辑?

如何在文本编辑器中设计撤消和重做?

如何在设计时从自定义TComponentEditor中显示ActionList编辑器

如何在设计编辑器预览的工具栏中显示后退箭头?

在Unity编辑器中创建脚本对象

是否有PropertyGrid集合编辑器的“添加”按钮事件或替代?

黑莓设计编辑器

如何保存使用富文本编辑器创建的站点/文档的结构,以再次创建只读视图和可编辑的富文本编辑器?

Swift如何在UIImagepickercontroller中为编辑器设置编辑器裁剪大小

剑道编辑器:如何在剑道编辑器中插入图像?

如何在Xcode动作编辑器上创建动作

如何在制表器中仅使选定的行可编辑?

如何在不创建ViewModel对象的情况下指定DataContext(ViewModel)类型以在XAML编辑器中进行设计时绑定检查?

如何在SpriteKit场景编辑器中访问导航图的对象

如何在编辑器中引用文件?

如何在volusion编辑器中添加javascript

如何在Xcode 11中垂直堆叠编辑器?

如何在Atom编辑器中运行Java程序?

CodeMirror:如何在编辑器中限制高度

如何在IntelliJ编辑器中关闭无限空白?

如何在Kendo UI编辑器中覆盖打印?

如何在Eclipse中更改编辑器的颜色