Display array in PropertyGrid


C

Chris

I am trying to do something very simple in a PropertyGrid. I wish to
display an array. Here is my code.

public class GridObject
{
private double[] _vec = new double[] { 1.0, 2.0 };

[RefreshProperties(RefreshProperties.All)]
[EditorAttribute(typeof(ArrayEditor), typeof
(System.Drawing.Design.UITypeEditor))]
public double[] Vector
{
get { return this._vec; }
set { this._vec = value; }
}
}

The array displays fine and it seems that the CollectionEditor is
being used to edit the array. A couple of things I would like to
change:
a) The user should not be allowed to add or remove elements from the
array, i.e the array length should be unchanged.
b) Is there any way I can format the elements in the array. e.g 1.0
appears as 1. Can I have it appear as 1.0000?

Is there any way that this can be accomplished?

Thanks for any help in this matter. Regards

Chris
 
Ad

Advertisements


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