开发者

Transpose a Collection

I've a list of different sizes of a T-Shirt, e.g. S, M, L. Since this might change for T-Shirts (sometimes we just have e.g. M, L), we load this into a List sizes.

Since most DataGrids (xamDataGrid, WPF Toolkit DataGrid) need Properties for binding to the Columns, I'd like to transpose somehow my data. Does anyone have an idea how to do this?

E.g. Instead of having List where Size { string sizeName, int available, int defect, int ordered}

    Avail.  Defect Ordered
[S]   1       2       3
[M]   1       2       3
[L]   1       2       3

I want an Object which has the Properties S, M, L containing the Values like this:

         [S]    [M]     [L]
Avail.    1      2       3
Defect    1      2       3
Ordered   1      2       3

The problem here is t开发者_StackOverflowhat I don't know how many sizes will be available for the tshirt, it might be 3, 4, or 10.

Thanks for any help

Cheers

PS: Here is a mockup of how the final grid should look like http://img39.imageshack.us/img39/9161/multirowspangridfixedel.png


You should take the Transpose extension from here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜