分组Listview项目 [英] Grouping Listview Items

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

问题描述

嗨每一个



我在c#中编写程序获取有关文件的详细信息以便稍后进行比较



我有4列的Listview控件

我使用以下代码将项目添加到listview



但是我需要根据列进行分组到第6列值



Hi every one

I wrote program in c# get details about files to compare them later

I have Listview control with 6 column
I an using the following code to add items to listview

but I need to group items according to column 6 values

var items = from f in Files_pathes_hash_Dup
                        select new ListViewItem(
                            new string[] {
                            new System.IO.FileInfo(f).Name, // Name
                            new System.IO.FileInfo(f).FullName, // Directory
                            new System.IO.FileInfo(f).CreationTime.ToString(), // Date Modified
                            new System.IO.FileInfo(f).Length.ToString(),
                            new System.IO.FileInfo(f).Extension,
                            f});
            listView_Files.BeginUpdate();
            listView_Files.Items.AddRange(items.ToArray());
            listView_Files.EndUpdate();





在添加每个项目之前,如何在没有指定组名的情况下执行此操作

因为我有大量的物品而且我这样需要很长时间





谢谢大家



how can I do that without specified group name before adding each items
because I have huge number of Items and I that way it will take long time


Thank you all

推荐答案

尝试:

Try:
var items = from fi in
                 (from f in files
                  select new FileInfo(f))
             select new string[] {
                 fi.Name, // Name
                 fi.FullName, // Directory
                 fi.CreationTime.ToString(), // Date Modified
                 fi.Length.ToString(),
                 fi.Extension };

你不应该在teh end需要原始路径,因为它已经作为FullName存在。

You shouldn't need the original path at teh end, since it is already there as the FullName.


这篇关于分组Listview项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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