Creating DataGrid for 2D array.

Sep 19, 2009 at 12:28 PM


Firstly sorry for asking very trivial question, but I am apparently unable to find it. All I want to do is create DataGrid out of 2 D array of integers. (completely in code) with or without automatic binding. Can you please help me?




Sep 19, 2009 at 6:32 PM
Edited Sep 19, 2009 at 6:33 PM

I got my answer. Updating the thread in case another beginner comes up with same question.

It seems to me that you have to bind DataGrid to a source to make it work. So just put your data in IEnumerable container like List and assign it to a ItemsSource property of DataGrid.