Add elements from IList to ObservableCollection

后端 未结 6 1651
臣服心动
臣服心动 2020-12-25 12:23

I have an ObservableCollection, and I\'d like to set the content of an IList to this one. Now I could just create a new instance of the collection..:

public         


        
6条回答
  •  失恋的感觉
    2020-12-25 13:28

    There is a library that solves this problem. It contains an ObservableList that can wrap a List. It can be used in the following way:

    List currentList = getMyList();
    var obvList = new ObservableList(currentList);
    

    https://github.com/gsonnenf/Gstc.Collections.ObservableLists

提交回复
热议问题