binding a grid to a collection of custom objects

G

Guest

Hi
I'm sorry for my english...

I have a clas that contains a variable number of data stored in a
dictionary. The key of the dictionary is a string that defines the name of
the field.

( varA 12
varB "a string"
varC 12/12/98
.....)

I need to create a binding between a grid and a collection of objects of
this class and have the variables varA, varB, varC as column fields (not the
public properties of the class...)

Any ideas? ICustomTypeDescriptor ? if so, how can i do this?

thanks....
 
N

Nicholas Paldino [.NET/C# MVP]

Pallet,

I wouldn't recommend implementing ICustomTypeDescriptor on the object
directly, as could cause problems in other areas where reflection is used on
it. Rather, I would implement this interface on another class, and have
that class take a reference to each instance of your object. That other
class would then be responsible for returning the properties based on what
is in your collection (through the implementation of the GetProperties
method).

Hope this helps.
 

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