【发布时间】: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编辑集合中的值。
我有两个问题:
为什么扩展器显示为禁用编辑?
如何允许用户通过 Expander 进行编辑?
【问题讨论】:
-
您的自定义
PropertyDescriptor实现是什么样的? “扩展器”是指网格内的[+]编辑吗?还是[…]编辑器?特别是,自定义属性描述符返回每个对象的 converter 是什么? -
@MarcGravell。
PropertyDescriptor看起来像PropertyDescriptor网站。 “扩展器”是指[+]、[...]= 收藏编辑器,我将其删除为MyEditor.cs。
标签: c# collections editor propertygrid expander