简体   繁体   中英

C# How do I get the ColumnHeader of a ListViewItem?

I haven't found the answer anywhere. How do I get the ColumnHeader of a given ListViewItem?

The context is that I am inside the ListViewColumnSorter (custom code). I have access to two ListViewItem's, how can I get the ColumnHeader? I need to access the column's tag which contains information I put in there through the VS designer.

ListViewItem横跨ListView中的所有列(例如lvItem.SubItems[0]是列1, lvItem.SubItems[1]是列2, lvItem.SubItems[1] 。您应该知道排序依据的列号。然后可以追溯到ListView属性:

ColumnHeader = lvItem.ListView.Columns[columnNumber];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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