Arokh Posted January 10, 2008 Posted January 10, 2008 Hi after quiet some time I finally found the problem why my ListView control isn't sorted despite the sorting: As soon as I add groups to the listview and assign them to the listviewitems (which are added after the groups are added), the ListView doesn't respect the insert method, it behaves as if I would use add instead. Immediately after setting lstvw_HistoryEps.ShowGroups = False the order of the listviewitems is correct. Does somebody know whats going on here? Quote
Leaders snarfblam Posted January 11, 2008 Leaders Posted January 11, 2008 Are you calling BeginUpdate and EndUpdate when updating the Items collection? Not doing so has caused me some very curious problems in the past. Quote [sIGPIC]e[/sIGPIC]
Arokh Posted January 11, 2008 Author Posted January 11, 2008 (edited) Adding didn't solve the problem. I didn't notice that there was a ListViewItemSorter element in the ListView available, so I've written my own sorting code, with which it doesn't work (as described above). If I use ListViewItemSorter to sort it works as it should. Although both ways should work, I'm going with the ListViewItemSorter since it means less code to write for me. Although it still interests me why it doesn't work my (old) way. EDIT OK it does work, but going with the ListViewItemSorter it is much slower than doing the sorting myself. So if you/anyone has another idea why it doesn't work... Edited January 11, 2008 by Arokh Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.