I have in a form two combo boxes that have the exact itemssource property. Both combo boxes need to be sorted, but in two different ways. One is sorted by the ID (numeric), the other one by Name(Alphabetic).
Is it possible to do such a thing?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How to sort listbox and comboboxes in WPF
http://www.kudzuworld.com/Blogs/Tech/20070815A.en.aspx
Since WPF does not provide a “Sort Order” property for its combo boxes, you need two different collections.
In the link I provided above, a commenter posted the following method using a ListCollectionView object to get a custom sort. This allows a single collection from your data source to be used, while adding an additional layer of collections for sorting: