|
There have been very similar posts before, but none help with this particular problem.
If I define a typesafe collection like this simplified version of the actual code
public class HighScore { public String Name; public Int32 Score; }
public class HighScoreList: CollectionBase, IList { public HighScore this[Int32 index] { get{ return (HighScore)InnerList[index]; } set{ InnerList[index] = value; } }
public void Add(HighScore highScore) { InnerList.Add(highScore); } }
I would expect to be able to display the list in a DataGrid by assigning an object of type HighScoreList to it's DataSource property, but if I do this the grid displays the correct number of rows, but no columns of data at all.
I know I can work around this by adding the data to a DataSet first, but I want to understand why the above method does not work, and what to change to make it work as expected. |