空的ListViewGroup没有在ListView中显示 [英] Empty ListViewGroup is not shown in ListView
问题描述
我找不到MSDN <一个在任何言论href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.groups.aspx">ListView.Groups 是空的ListViewGroup房产将被隐藏。它是在设计上,还是我失去了一些东西?我的示例code以下,只显示组2项目ITEM1。
I could not find any remarks on MSDN ListView.Groups Property that empty ListViewGroup will be hidden. Is it by design, or I am missing something? My sample code below will show only "group 2" with item "item1".
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
'
Dim gr = New ListViewGroup("group 1")
ListView1.Groups.Add(gr)
'
Dim gr2 = New ListViewGroup("group 2")
ListView1.Groups.Add(gr2)
'
Dim lvi As New ListViewItem("item1")
ListView1.Items.Add(lvi)
'
gr2.Items.Add(lvi)
End Sub
更新时间: 是否有任何方式来显示的ListViewGroup无需添加虚拟物品
Updated: Is there are any way to show ListViewGroup without adding dummy item
目前唯一的解决方法的想法我是用可折叠列表视图(Vista和最多)
For now the only workaround idea I have is to use collapsible listview (Vista and up)
推荐答案
无法通过微软设计的。照片
只看<一本讨论href="http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/39681a70-d992-4046-ad7e-21a2e33791b1"相对=nofollow> social.msdn.microsoft.com 。
不要被标题所迷惑。它谈论空组。
Is not possible by Microsoft design.
Look at this discussion on social.msdn.microsoft.com.
Don't be fooled by title. It talks about empty groups.
这篇关于空的ListViewGroup没有在ListView中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!