How do I fill a DataGrid
from a List
typed?
Would it be possible to generate the columns automatically?
How do I fill a DataGrid
from a List
typed?
Would it be possible to generate the columns automatically?
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
.