Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Trouble binding to custom IList implementation
posted

I've had some trouble lately binding the UltraGrid to a custom collection. I've got a class hierarchy/organization as follows:

  • An abstract base class from which a number of business objects are derived.
  • An abstract generic custom collection class that is constrained to the abstract base class and implements the IList interface as well as having a single custom property.
  • A concrete business class that derives from the abstract base class
  • a concrete collection class that derives from the abstract collection class and is typed to the concrete business class. This class adds its own custom property.

In my solution I've instantiated one of these custom collections (and added items to it) and set it to the grid's DataSource but what I see are the columns based on the two custom properties available from the collection class hierarchy (i.e. one from the base class and one from the derived class) rather than the properties of the business object (i.e. the type of the collection).

Interestingly when I try to use a binding source I do see the structure as initially expected but I get a type error when attempting to add items through the binding source.

Before delving too deeply into figuring out the binding source issue I'd like to know if there is some factor I'm missing when attempting to bind directly to the grid. Hope you guys can shed some light on this one.

 

thanks