Data binding list including its columns

I have a list of objects, each containing a stern number of parameters (name, value pairs). Now I want to bind a list of objects to a list. Each column must represent a parameter (the column heading is the parameter name), and each row must represent an object with a list of parameter values. How can you ensure that the columns, including its header names, are created through data binding based on parameter names? Note that the number of parameters can differ from object to object, so the column element must sometimes be empty.

0


source to share


1 answer


By parameters, do you mean properties?

If so, it might help:
I think the data binding engine will take the first object and use it as a proxy for everyone else.
This way your list will have all columns like properties from the first object.

To achieve the desired result, you must



  • Create a mock object with all possible properties
  • Insert this as the first item in the list

This should work ... Use reflection when you are using C # :-)

0


source







All Articles