<p>How do I set the column which has the header sort glyph, and its direction, in a .NET 2.0 WinForms ListView?</p>

<h2>Bump</h2>

<p>The listview is .net is not a managed control, it is a very thin wrapper around the Win32 ListView common control. It's not even a very good wrapper - it doesn't expose all the features of the real listview.</p>

<p>The Win32 listview common control supports drawing itself with themes. One of the themed elements is the header sort arrow. Windows Explorer's listview common control knows how to draw one of its columns with that theme element.</p>

<ul>
<li>does the Win32 listview support specifying which column has what sort order?  </li>
<li>does the Win32 header control that the listview internally uses support specifying which column has what sort order?  </li>
<li>does the win32 header control support custom drawing, so I can draw the header sort glyph myself?</li>
<li>does the win32 listview control support custom header drawing, so I can draw the header sort glyph myself?</li>
<li>does the .NET ListView control support custom header drawing, so I can draw the header sort glyph myself?</li>
</ul>

[{'answer_id': 73331, 'author': 'DevelopingChris', 'author_id': 1220, 'author_profile': 'https://Stackoverflow.com/users/1220', 'pm_score': 1, 'selected': False, 'text': '<p>I use unicode arrow characters in the title of the column and make the header a linkbutton.</p>\n'}, {'answer_id': 2072955, 'author': 't0mm13b', 'author_id': 206367, 'author_profile': 'https://Stackoverflow.com/users/206367', 'pm_score': 1, 'selected': False, 'text': '<p>There is a listview that I use that has that in-built into it. It\'s called <a href="http://www.codeproject.com/KB/list/XPTableListViewUpdate.aspx" rel="nofollow noreferrer">XPTable</a>..I am digging around my source code to find that helper class that will draw the glyph based on the sort order...This is the code that I have used <a href="http://www.codeproject.com/KB/list/lvsortmanager.aspx" rel="nofollow noreferrer">here</a>..</p>\n\n<p>Hope this helps,\nBest regards,\nTom.</p>\n'}, {'answer_id': 26857392, 'author': 'IlPADlI', 'author_id': 2430943, 'author_profile': 'https://Stackoverflow.com/users/2430943', 'pm_score': 1, 'selected': False, 'text': '<p>This article is helpful, uses SendMessage DllImport.</p>\n\n<p><a href="http://www.codeproject.com/Tips/734463/Sort-listview-Columns-and-Set-Sort-Arrow-Icon-on-C" rel="nofollow">http://www.codeproject.com/Tips/734463/Sort-listview-Columns-and-Set-Sort-Arrow-Icon-on-C</a></p>\n'}, {'answer_id': 36332488, 'author': 'Adam', 'author_id': 5250659, 'author_profile': 'https://Stackoverflow.com/users/5250659', 'pm_score': 2, 'selected': False, 'text': '<p>In case someone needs a quick solution (it draws up/down arrow at the beginning of column header text):</p>\n\n<p><strong>ListViewExtensions.cs:</strong></p>\n\n<pre><code>public static class ListViewExtensions\n{\n    public static void DrawSortArrow(this ListView listView, SortOrder sortOrder, int colIndex)\n    {\n        string upArrow = "▲   ";\n        string downArrow = "▼   ";\n\n        foreach (ColumnHeader ch in listView.Columns)\n        {\n            if (ch.Text.Contains(upArrow))\n                ch.Text = ch.Text.Replace(upArrow, string.Empty);\n            else if (ch.Text.Contains(downArrow))\n                ch.Text = ch.Text.Replace(downArrow, string.Empty);\n        }\n\n        if (sortOrder == SortOrder.Ascending)\n            listView.Columns[colIndex].Text = listView.Columns[colIndex].Text.Insert(0, downArrow);\n        else\n            listView.Columns[colIndex].Text = listView.Columns[colIndex].Text.Insert(0, upArrow);\n    }\n}\n</code></pre>\n\n<p><strong>Usage:</strong></p>\n\n<pre><code>private void lstOffers_ColumnClick(object sender, ColumnClickEventArgs e)\n{\n    lstOffers.DrawSortArrow(SortOrder.Descending, e.Column);\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/73320', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12597/']