I came across a little problem, and we got the same with standard silverlight Datagrid :

How to dynamically build the datagrid ?

AgDatagrid and Silverlight Datagrid use IList type to build the control Datasource. When using managed code (C# or VB.NET in silverlight development), you need to build a Class representing your data to build the IList :

1:publicclass Person {

2:publicstring Name {

3: get;

4: set;

5: }

6:

7:publicstring City {

8: get;

9: set;

10: }

11:

12:publicstring State {

13: get;

14: set;

15: }

16: }

17:

18:new Person() {

19: me = "Michael Jordan", City="Chicago", State="IL" },

20:new Person() {

21: me = "Kobe Bryant", City="Los Angeles", State="CA" },

22:new Person() {

23: me = "Shaquille O'Neil", City="Miami", State="FL" },

24:new Person() {

25: me = "Patrick Ewing", City="New York", State="NY" }

26:

That's ok when you know what kind of data will be bound to the grid, but how to do this when you have dynamic content ?

I plan to use this grid to represent data coming from PowerShell... So I don't know how many column and type of Data I'll have to implement.

here is the point :I can't use a static class to define my Data in the Silverlight Control.

Game Over ?

Not Yet!

We could follow two path to achieve this :

Use Dynamic Language programming with Silverlight (ironPython,ironRuby, Managed JScript...) that let us build dynamically the control ?

Dynamically build the class in managed code ?

Using Dynamic language will be an elegant (and for me the best) way to do it. However, we're dealing with Beta version here, and it's not so easy to use external control and SL2B2 controls in this context (yet), so I won't explain it for now (waiting for the MS Silverlight Team to publish some samples on it ;) )

So, could we dynamically build the Class in our managed code ?

my answer is : YES !

How to generate typed objects dynamically

After some search (HEAVY search should I say), I just found this marvelous thread from Vladimir Bodurov on "how to generated dynamically typed objects in .NET :