【问题标题】:Populate listView control with items from a List<ListViewItem>使用 List<ListViewItem> 中的项目填充 listView 控件
【发布时间】:2016-11-28 03:28:36
【问题描述】:

我有 四个 List&lt;ListViewItem&gt;一个 listView control

我想要的是用列表中的项目填充控件。

我该怎么做?

【问题讨论】:

    标签: c# winforms list listview listviewitem


    【解决方案1】:

    我要做的是首先将四个列表合并为一个,然后将它们添加到 ListView 的 Items 集合中。

    var allListItems = list1.Concat(list2)
                            .Concat(list3)
                            .Concat(list4)
                            .ToList();
    
    listView.Items.AddRange(allListItems);
    

    这不是很漂亮或性能最好的解决方案,但它可以完成工作。查看this thread 以更好地了解如何将多个列表合并为一个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-20
      • 1970-01-01
      • 2013-12-17
      • 1970-01-01
      • 2016-03-18
      • 2016-09-21
      相关资源
      最近更新 更多