Binding multifunctional WPF DataGrid
问题 How would you go about binding a WPF datagrid that needs to display data from many different datasources with varying number of columns with different column headers and types? What I'm currently doing is creating a custom List<DataGridColumn>() list of datagrid columns in my ViewModel for each different collection of records to be displayed in this DataGrid. I Loop over this List to set the DataGrid columns: foreach (DataGridColumn dgc in dgcSample) { dgc.HeaderStyle = hStyle; dgMyDataGrid