开发者

How to set group headers in listview not selectable?

I need some help for my listview element, I want to use listview with groups. But i want to make the group headers not selectable, i want to use them as a separator?

How can I do this?


I've added this.lstView.SelectedIndexChanged event listener. Also I have two groups where I need every index from each item. If I debug the index with ((ListViewItem)lstView.SelectedItems[0]).Index in the event listener I get an exception if the group header is selected, so I want to disable the selecting of 开发者_如何学编程group headers.


Solution:

alt text http://i.msdn.microsoft.com/dynimg/IC16066.gif

// Adds a new group that has a left-aligned header
listView1.Groups.Add(new ListViewGroup("List item text", HorizontalAlignment.Left));

You can find more information about it on http://msdn.microsoft.com/en-us/library/ezh1batz.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜