Can I populate a DataGrid with a ListT?

3

How do I fill a DataGrid from a List typed?

Would it be possible to generate the columns automatically?

    
asked by anonymous 08.05.2014 / 20:03

1 answer

3

Yes ItemSource of DataGrid (vi that your case is WPF) you can pass any enumeration (IList, ICollection, etc.)

DataGrid1.ItemsSource = (new List<T>());

Where new List<T>() is your list.

To enable automatic column creation, put True in AutoGenerateColumns in your DataGrid of WPF .

    
08.05.2014 / 20:07