How to preserve TwoWay binding of CurrentItem when databinding to CollectionViewSource in ComboBox

前端 未结 4 1845
粉色の甜心
粉色の甜心 2021-01-04 03:07

Lets say we got a simple VM class

public class PersonViewModel : Observable
    {
        private Person m_Person= new Person(\"Mike\", \"Smith\");

                 


        
4条回答
  •  佛祖请我去吃肉
    2021-01-04 03:50

    I highly recommend the use of ComboBoxExtensions by Kyle McClellan of Microsoft, found here.

    You can declare a datasource for your ComboBox in XAML - and it's far more flexible and usable in async modes.

    Basically the solution, largely, is NOT to use CollectionViewSource for ComboBoxes. You can do the sorting on the server side query.

提交回复
热议问题