PropertyGrid/CollectionEditor/Array sub-element


E

ec

Hi, I'm having a problem editing a collection with the PropertyGrid in C#,
and hope someone can shed some light.
The collection consists of structs consisting of a string (Name), and
double[] array (Data). I can add the colelction OK to the PropertyGrid, and
it displays OK, and lets me edit the collection elements OK. But when I add
an element in the collection editor, it displays a new blank element in the
left pane; I click on the Data element, and add values to the double[]
array; however the new values are not displayed when I return to the main
collection editor window. A new element has been added to the collection
with the new name, but the array is null.
So what do I need to do? I have tried various suggestions whcih may not be
relevant from other postings eg DesignerSerializationVisiblity.Content
and/or InstanceDescriptor.
I have resorted to representing the array as a string of values for the
moment.
Ed
 
Ad

Advertisements

E

ec

OK, it looks like the CollectionEditor doesn't create a new array.
If I change the constructor for the element type in the collection, so that
the array variable is initialised to a new array of zero length, then
everything is sweet.
Does this seem plausible?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top