I’m writing a fancy business-logic class that’s essentially a table with an unknown number of columns, constructed dynamically, which includes various methods for validation, data processing etc.
It’s an IEnumerable of specialized row objects, which allow access to their columns through a BusinessData this[string columnName] { get { ... } } accessor. Almost like a DataTable.
I’d like to be able to data-bind it to a WPF DataGrid, so I want to write the following:
dataGrid1.ItemsSource = myFancyMemoryTable;
But, of course, it won’t work, because the DataGrid will bind itself to the public properties of my row objects, and not to the columns that contain the business data. How do I get the behavior I want from it?
I cannot specifically track down where the properties are retrieved for
DataTables/DataRowsbut if you implementITypedListon your source collection that should work.