Currently I am making a mini music player / organizer for myself. However, when using a list view, it sorts alphabetically, and doesn’t ignore “The” and “A”:
- A Lot Like Me
- Adiago For Strings
- Stay Crunchy
- The Foresaken
- Time to Pretend
should be:
- Adiago For Strings
- The Foresaken
- A Lot Like Me
- Stay Crunchy
- Time To Pretend
It’s all loaded from a multi-dimensional array, and I’ve even tried filtering out “The” and “A” manually, and then display the real name (from a different array), but then it just sorts the displayed name (including “The” and “A”)
What you could do is to create a customer comparer and set it on your
ListViewinstance using the ListView.ListViewItemSorter property. Then, your comparer is responsible for remvoing “the” and “a” from the start of the items being compared.When your
ListViewis sorted, it will use this custom comparer to sort with, but the original values including “the” and “a” will be used as display values in theListView(ie. you do not need to modify the values you put in theListView– the comparer just ignores the words you want it to when sorting).