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 :

lundi 7 juillet 2008

Update : People asked me a preview of Poshboard to play with it : so be it ! A preview is now available on codeplex here, or follow this link : http://www.codeplex.com/poshboard

Here's a little video of my "coming soon" open source project called "PowerShell Dashboard" (PoshBoard for friends). This project will be available soon on the open source forge of my company Octo Technology.

The goal of this project is to deliver modular web portal based on PowerShell. The idea is to use Web GUI like igoogle, PageFlakes or Netvibes, for IT Admin and infrastructure management.

This will let you easely build infrastructure dashboards without the need to code in ASP.NET / AJAX / C# or other compiled language :

All you need to know is scriptingAll you need to have is imagination.;)

This project is based on Dropthings, a great ASP.NET/AJAX open source project by Omar Al Zabir, turned to an intranet project.

For this first teaser, I show you a first widget to generate Silverlight charts directly fom PowerShell scripts. I've used Chart generation (Column, pie...) with the great Silverlight charting library VISIFIRE (free and open source too)

This first demonstation presents the general concept of the web portal. It'll be freely available in the coming weeks. Then I'll propose several componants and innovations that will let you have much fun with PowerShell development ! :)