I'm creating a simple application that simply populates a DataGridView with a strongly typed DataTable. My problem is that all the cells show up empty despite containing data, I have a CellDoubleClick event which can pick up the underlying value of the cell (which is typed as expected) but the column is shown as empty.
Objects of type INode all have a ToString() method defined and my assumption was that the DataGridView would be intelligent enough to call that method any show that as the cell contents but it appears not.
Here is my current test code:
//Add some fake test data
DataTable data = new DataTable();
data.Columns.Add("Subject");
data.Columns.Add("Predicate");
data.Columns.Add("Object");
data.Columns["Subject"].DataType = typeof(INode);
data.Columns["Predicate"].DataType = typeof(INode);
data.Columns["Object"].DataType = typeof(INode);
Graph g = new Graph();
DataRow row = data.NewRow();
row["Subject"] = g.CreateURINode(new Uri("http://example.org/subject"));
row["Predicate"] = g.CreateURINode(new Uri("http://example.org/predicate"));
row["Object"] = g.CreateURINode(new Uri("http://example.org/object"));
data.Rows.Add(row);
this.dvwBrowser.DataSource = data;
this.dvwBrowser.AutoResizeColumns();
How can I get the value of the ToString() method to be displayed in the cells when I bind the DataTable to the DataGridView?