转置收藏 [英] Transpose a Collection

查看:70
本文介绍了转置收藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我列出了不同尺寸的T恤,例如S,M,L。由于T恤可能会有所变化(有时我们只有M,L),因此我们将其加载到List尺寸中。

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.

DataGrid(xamDataGrid,WPF工具包DataGrid)需要用于绑定到列的属性,我想以某种方式转置我的数据。有人知道怎么做吗?

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?

例如而不是使用List,其中Size {字符串sizeName,可用int,可用int缺陷,可用int排序}

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

我想要一个对象,该对象的属性S,M,L包含以下值:

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

问题这里是我不知道T恤有多少种尺寸,可能是3、4或10。

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

感谢您的帮助

欢呼

PS:以下是最终网格应为 http://img39.imageshack.us/img39/9161/multirowspangridfixedel.png

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

推荐答案

您应该使用 Transpose 扩展名从这里

这篇关于转置收藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆