DataGrid.DataSource and binding

J

Jo Siffert

Hi all,

I would like to use a collection of structs like the ones below as the
DataSource for a DataGrid:

struct Foo {
Bar[8] bar;
string a;
string b;
}
struct Bar {
string c;
string d;
}

I would like to construct a table that has columns like:
a, b, bar[0].c, bar[1].c, bar[1].d, ...

A rather ugly way accomplish this, would be to flatten these structs
into a string[18]-array and use an IList of string[]-objects as the
DataSource of the grid.

But if I did so, is it possible to establish bindings between the
Columns and the fields of the array? In the documentation of Binding
arrays are not mentioned as candidates for binding... which parameters
would I have to pass to the Binding-constructor?

MSDN also mentions that you can use an IListSource containing an IList
of ILists as DataSource. How is it possible to use binding here?

Thanks,
Jo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top