« Remember: ArrayList of structs has value semantics. | Main | Event handler patterns. »

DataGrid bound to ArrayList and System.Array, CurrencyManager handles consistency not formatting

DataGrid’s can trivially be used to display ArrayLists by setting the DataSource property of the grid to the ArrayList object, just remember that the objects in the list must have public properties.

CurrencyManager has to do with keeping bindings current not with formatting cash.

To use column styles with a System.Array DataSource, the DataGridTableStyle.MappingName property must be set to the type name of the array. i.e. “DataItem[]”. The value to use can be seen after setting the DataSource of the grid from the debugger by looking at the protected ListManager property’s BindType.Name value.

 

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)