简体   繁体   English

将列数据绑定到集合

[英]Data-bind a column to a collection

I have multiple Users, each with a collection of Tasks. 我有多个用户,每个用户都有一组任务。

public class User {
    public string Name { get; set; }
    public IEnumerable<Task> Tasks { get; set; }
}

public class Task {
    public string Name { get; set; }
}

What I would like to do in Silverlight is have each User represented as a column, with Tasks represented as items in the column. 我想在Silverlight中做的是将每个用户表示为一列,而将任务表示为该列中的项目。 I know it's easy to data-bind with rows, but what about columns? 我知道与行进行数据绑定很容易,但是列呢?

Can I do this with a traditional list view, or should I create my own grid-based control? 我可以使用传统的列表视图来执行此操作,还是应该创建自己的基于网格的控件?

You could have a ListView inside a ListView. 您可以在ListView中有一个ListView。 The parent would be the headers(in your case users), and the child ListView would have the DataSource of Task, and it would list the user's tasks. 父级将是标题(在您的情况下为用户),子级ListView将具有Task的数据源,它将列出用户的任务。 Is this possible in SilverLight? 在SilverLight中有可能吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM