简体   繁体   English

将子项添加到Listview

[英]Add subItem to Listview

Now, I know how to add SubItems, but this time it's slightly different from my usual method. 现在,我知道如何添加SubItems,但这一次它与我通常的方法略有不同。 below is what I'm using to add items to my listview, however using this I cannot figure out how to add subitems. 以下是我用来向列表视图添加项目的方法,但是使用此方法我无法弄清楚如何添加子项目。

listView1.Items.Add(Path.GetFileName(f));

Try this: 尝试这个:

listView1.Items.Add(Path.GetFileName(f));

listView1.Items[0 /* or any index you need */].SubItems.Add("SubItem");

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

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