Is there a template reverse order in Listbox? I’m using ObservableCollection and I would like to avoid any extra sorting, inserting etc.
Is there a template reverse order in Listbox? I’m using ObservableCollection and I would
Share
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.
If you use Linq, you should be able to just .OrderByDescending()? Have a look at an example here – http://msdn.microsoft.com/en-us/vcsharp/aa336756.aspx
If this is for the score list you were working on from a previous question, you should be able to just order by the score amount if it’s stored as an integer, without having to create a custom comparer function. An example linq query to order your list would be something like:
Once you have the IEnumerable result of the Linq, you can recreate an ObservableCollection and reassign to your ViewModel (Cast LINQ result to ObservableCollection)