简体   繁体   English

在属性网格中编辑数组/列表

[英]Editing array / List in property grid

I have a list in the PropertyGrid , and an array. 我在PropertyGrid有一个列表,还有一个数组。

When the array opened in expander ( + ) can edit it, 当在扩展器( + )中打开的数组可以编辑时,

but when the list opens in expander can not edit it. 但是在扩展器中打开列表时,无法对其进行编辑。

What is the difference between them? 它们之间有什么区别?

I saw this question: 我看到了这个问题:

Modify default behaviour of PropertyGrid and TypeConverterAttribute 修改PropertyGrid和TypeConverterAttribute的默认行为

that in order to prevent editing by the expander is turned array to a list. 为了防止扩展器进行编辑,将数组转换为列表。

Why in the array can to edit, and the list can not be edited? 为什么在数组中可以编辑,而列表却不能编辑?

How can I change this? 我该如何更改? (Or can not be ?) (还是不能?)

I found the reason why you can not edit, 我发现了您无法编辑的原因,

because each value in a list is an object you can not edit it, 因为列表中的每个值都是一个object您无法对其进行编辑,

even though I put in GetValue one value from the object. 即使我从对象中将GetValue放入一个值。

I opened the object in a list in expander and edited there. 我在扩展器的列表中打开了对象,然后在其中进行了编辑。

AS my suggestion it is better to use List because List is auto implemented array list which the size is flexible compare to array we need to assign it. 作为我的建议,最好使用List,因为List是自动实现的数组列表,其大小与我们需要为其分配的数组相比具有灵活性。 Find out more in http://www.dotnetperls.com/list http://www.dotnetperls.com/list中找到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM