datagridtablestyle

How do you get the proper mapping name from a binding source bound to a List<T>, or an anonymous type, to use on a DataGridTableStyle?

喜你入骨 提交于 2019-12-09 14:20:09
问题 I'm trying to create a DataGridTableStyle object so that I can control the column widths of a DataGrid. I've created a BindingSource object bound to a List. Actually it's bound to an anonymous type list created though Linq in the following manner (variable names changed for clarity of what I'm doing): List<myType> myList = new List<myType>(someCapacity); . ...populate the list with query from database... . var query = from i in myList select new { i.FieldA, i.FieldB, i.FieldC };

How do you get the proper mapping name from a binding source bound to a List<T>, or an anonymous type, to use on a DataGridTableStyle?

限于喜欢 提交于 2019-12-03 23:32:49
I'm trying to create a DataGridTableStyle object so that I can control the column widths of a DataGrid. I've created a BindingSource object bound to a List. Actually it's bound to an anonymous type list created though Linq in the following manner (variable names changed for clarity of what I'm doing): List<myType> myList = new List<myType>(someCapacity); . ...populate the list with query from database... . var query = from i in myList select new { i.FieldA, i.FieldB, i.FieldC }; myBindingSource.DataSource = query; myDataGrid.DataSource = myBindingSource; Then I create a DataGridTableStyle