int[] property vs PropertyGrid

C

Claus Christiansen

Hi,

I'm creating a control inherited from System.Windows.Forms.Control and I
want to add a public float[] property that should be visible in the
PropertyGrid.

Having read "Building Windows Forms Controls and Components with Rich
Design-Time Features" part 1 & 2 on MSDN I thought this would be a breeze
(and with simple properties like in the articles it is). However, the
float[] property leaves me baffled.

I've made a FloatArrayConverter inherited from TypeConverter and
decorated the property with:
[DefaultValue(null),
TypeConverter(typeof(FloatArrayConverter)),
DesignerSerializationVisibilityAttribut
(DesignerSerializationVisibility.Content),
Description("Array of values")]

But entering values into the Single Collection Editor that pops up are
not persisted or even converted.

I guess I can make a workaround by creating my own UITypeEditor but it
seems that I'm 'almost there'.

I've tried letting the TypeConverter inherit from ArrayConverter and
ExpandableObjectConverter with no luck.

Any ideas?

Regards
/Claus
 
F

Frank Hileman

Hello Claus,

In fact float[] cannot be deserialized properly due to a bug in MS code.
Create a struct with the float data, and a typeconverter for that, then it
should work.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated VS.net graphics editor
 

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