Note that there are some explanatory texts on larger screens.

plurals
  1. POList is not updated when multiple objects are selected in PropertyGrid
    primarykey
    data
    text
    <p>I am trying to solve an issue where multiple objects with the same type are selected in a property grid. All these objects provide an array of strings. During my investigations, I figured out that an array can not be edited by the user so I switched to a List and am using a custom editor to edit these strings. That seems to work okay but what ponders me at the moment is that the property is not updated in neither of the selected objects.</p> <p>Let's go into detail with a simple and short example. Let's say you've got this class:</p> <pre><code>public class MyProperties { private List&lt;string&gt; _channels; public MyProperties() { _channels = new List&lt;string&gt;(); } [Editor(@"System.Windows.Forms.Design.StringCollectionEditor," + "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))] public List&lt;string&gt; Channels { get { return _channels; } } } </code></pre> <p>I am selecting three objects of this type for my property grid:</p> <pre><code>public partial class Form1 : Form { private MyProperties[] _properties; public Form1() { InitializeComponent(); _properties = new MyProperties[3]; for (int i = 0; i &lt; _properties.Length; ++i) _properties[i] = new MyProperties(); propertyGrid1.SelectedObjects = _properties; } } </code></pre> <p>Now, when I'm starting the example, I am able to open the proper string list editor to edit my channel list. When clicking , none of the MyProperties objects contains the configured list of strings.</p> <p>The above example works without problems when only selecting a single instance of MyProperties:</p> <pre><code>propertyGrid1.SelectedObject = _properties[0]; </code></pre> <p>Is there something I'm doing wrong or is something more required to get it to work? Thank you in advance for your efforts!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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