wpf - How can I sort a bound ListBox with custom sort logic? -


i'd sort view instead of in viewmodel.

every example i've seen uses sortdescription, it's not customizable.

the viewmodel can responsible data consumed view , presentation, model should not concerned display of data.

you bind view observablecollection on viewmodel, have. not saying how allow user sort, arguments sake assuming series of buttons, each button bound icommand on viewmodel, modify observablecollection change order.

this refresh view new order in observablecollection.

you still maintaining layers, , avoiding code behind , allowing sorting logic tested.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -