Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The PropertyGrid is an old grumpy beast. It needs the non-generic <a href="http://msdn.microsoft.com/en-us/library/system.collections.ilist.aspx" rel="nofollow">IList</a> explicit implementation, not the generic one.</p> <p>As a site note, you could derive ZoneCollection directly from <code>List&lt;Zone&gt;</code>, and you don't need any ICustomTypeDescriptor / PropertyDescriptor, with regards to this PropertyGrid issue.</p> <p>Here is an implementation that seems to work:</p> <pre><code>public class ZoneCollection : IList&lt;Zone&gt;, IList { private List&lt;Zone&gt; _list = new List&lt;Zone&gt;(); public ZoneCollection() { } public int IndexOf(Zone item) { return _list.IndexOf(item); } public void Insert(int index, Zone item) { _list.Insert(index, item); } public void RemoveAt(int index) { _list.RemoveAt(index); } public Zone this[int index] { get { return _list[index]; } set { _list[index] = value; } } public void Add(Zone item) { _list.Add(item); } public void Clear() { _list.Clear(); } public bool Contains(Zone item) { return _list.Contains(item); } public void CopyTo(Zone[] array, int arrayIndex) { _list.CopyTo(array, arrayIndex); } public int Count { get { return _list.Count; } } public bool IsReadOnly { get { return ((IList)_list).IsReadOnly; } } public bool Remove(Zone item) { return _list.Remove(item); } public IEnumerator&lt;Zone&gt; GetEnumerator() { return _list.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } int IList.Add(object value) { int index = Count; Add((Zone)value); return index; } bool IList.Contains(object value) { return Contains((Zone)value); } int IList.IndexOf(object value) { return IndexOf((Zone)value); } void IList.Insert(int index, object value) { Insert(index, (Zone)value); } bool IList.IsFixedSize { get { return ((IList)_list).IsFixedSize; } } bool IList.IsReadOnly { get { return ((IList)_list).IsReadOnly; } } void IList.Remove(object value) { Remove((Zone)value); } object IList.this[int index] { get { return this[index]; } set { this[index] = (Zone)value; } } void ICollection.CopyTo(Array array, int index) { CopyTo((Zone[])array, index); } bool ICollection.IsSynchronized { get { return ((ICollection)_list).IsSynchronized; } } object ICollection.SyncRoot { get { return ((ICollection)_list).SyncRoot; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload