0

I am modifying an existing application which uses a property grid to display the properties of a selected item from a third party control. The selected item always inherits from an 'Item' object which contains a 'DataField' string property.

I need to modify the way which the propertygrid displays the child objects so that the user can select the data field from a list of values which will be populated from a collection on the parent form.

Is this possible with the propertygrid?

Barry
  • 99
  • 1
  • 8

2 Answers2

1

If I understand your question correctly, maybe How do you create a custom collection editor form for use with the property grid? could solve your problem.

Community
  • 1
  • 1
Rene Hilgers
  • 390
  • 3
  • 13
  • That answers part of the question. The other part is how do I use this editor with the propertygrid which is bound to a third party object. – Barry Jan 27 '14 at 13:12
0

You could do something like this:

Step 3)Tell the PropertyGrid to use the alternate editor. The change between this property and any other that is used in the PropertyGrid control is the [Editor] line.

[Description("The name or text to appear on the layout.")]
[DisplayName("Text"), Browsable(true), Category("Design")]
[Editor(typeof(StringArrayEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string[] Text {get; set;}

it is part of this answer: Is there a better StringCollection editor for use in PropertyGrids?

I hope this helps you.

Community
  • 1
  • 1
real_yggdrasil
  • 1,213
  • 4
  • 14
  • 27
  • That would work well if I was using my own custom objects but I have to use third party objects which I cannot edit. – Barry Jan 27 '14 at 13:24