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
210
Dynamic Datasource Columns in UltraGrid
posted

Hi,

I'm looking to bind an ultragrid to a dynamic datasource. The source of my data is found in a list of "prices" objects, which have Properties holding the numbers I want displayed.

It would work perfectly to create an object MyDataRow which would encapsulate some of the "prices" objects, and expose one property for each column.

That way I could use a BindingList of MyDataRow objects, and each column would be nicely bound to the UltraGrid, with a proper INotifyPropertyChanged implementation to insure the grid refreshes when my underying "prices" change.

However, one of my constraints is that I need to dynamically add columns at run time. That seems to be a problem.

Indeed, since on this architecture a column is necessarily a Property of the MyDataRow object, I cannot dynamically modify the class to add Properties, and then fill all the existing instances...

How can I get around this problem, and properly have BOTH Databinding to object properties AND dynamic column creation in an ultragrid?

Parents Reply Children