views:

54

answers:

1

I've just begun learning Silverlight (though I have 3 years C# experience). I'm trying to output a grid that will be used in a work timetracking application. I have a list of objects, each object looks like this

public class WorkItem
{
    public int TaskId {get;set;}
    public int WeekId {get;set;}
    public DateTime Date  {get;set;}
    public decimal TimeSpent {get;set;}
    public string TaskName {get;set;}
}

Obviously I could just set a grid's item source to a list of these objects and I'd end up with them output in some sort of grid. However I am wanting to output as grid with taskNames down the left handside and days of the week across the top. (i.e. just displaying one week at a time). Each cell would then just output a timeSpent value.

I've managed to do this in ASP.Net MVC with just html table etc though I'm not really sure where to start with a silverlight version.

If anyone could point me in the right direction it would be much appreciated, (i.e. any pointers on what to read up on etc.)

+1  A: 

Came up with my own solution, I just created a separate class that represented each row. The class has properties monday, tuesday wednesday etc that contained one of the objects described above.

bplus
I was about to suggest that. Do the translation in code and use data binding to a DataGrid (not a Grid, right?)
Brian Genisio
Yeah DataGrid not grid.Solution works ok, I have an IDictionary<System.DayOfWeek, TimeSlotItem>, the properties that the grid binds to just point at this dictionary and only expose the time field.
bplus