【问题标题】:Editing in Propertygrid not enabled from Expander未从 Expander 启用在 Propertygrid 中的编辑
【发布时间】:2013-04-10 12:20:24
【问题描述】:

我在 Propertygrid 中有一个由扩展器打开的列表。我使用以下站点创建了它: Customized display of collection data in a PropertyGrid.

我添加了这个编辑器类型来取消Collection Editor

class MyEditor: UITypeEditor
{
    public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
    {
        return UITypeEditorEditStyle.None;
    }
}

[TypeConverter(typeof(ExpandableObjectConverter))]
[Editor(typeof(MyEditor), typeof(UITypeEditor))]
public class MyCollection : CollectionBase, ICustomTypeDescriptor
{...}

问题是你无法通过Expander编辑集合中的值。

我有两个问题:

  1. 为什么扩展器显示为禁用编辑?

  2. 如何允许用户通过 Expander 进行编辑?

【问题讨论】:

  • 您的自定义PropertyDescriptor 实现是什么样的? “扩展器”是指网格内的[+] 编辑吗?还是[…] 编辑器?特别是,自定义属性描述符返回每个对象的 converter 是什么?
  • @MarcGravell。 PropertyDescriptor 看起来像 PropertyDescriptor 网站。 “扩展器”是指[+][...]= 收藏编辑器,我将其删除为MyEditor.cs

标签: c# collections editor propertygrid expander


【解决方案1】:

我找到了你不能编辑的原因,

因为列表中的每个值都是object,所以你不能编辑它,

即使我从对象中输入了GetValue 一个值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多