Originally published at Fiberglass flowers. You can comment here or there.
Whenever you implement own datasource for .NET GUI binding, you’lll have the choice - whether to implement IList or IListSource.
IListSource is a simplistic interface with two members: IList<T> GetList() and bool ContainsListCollection;
MSDN help about IListSource.ContainsListCollection states it’s “indicating whether the collection is a collection of IList objects”.
MSDN is not true here.
If IListSource.ContainsListCollection is false, GetList() just returns your IList.
If IListSource.ContainsListCollection is true, GetList() is expected to return ITypedList, which needs to provide a collection of PropertyDescriptor-s for every field of your collection.
Its purpose is to provide field names (including by-name field access) in runtime.
Quoted below is a code piece from a Microsoft newsgroup that resolves both cases to a data list (field values list, in second case).
And yes, if you’re planning to mutate the UI-bound collection, use IBindingList<> instead of IList<>.
(no subject)
9/10/08 08:03 (UTC)Было бы немного более понятна суть статьи — если бы ты описал проблему ее вызвавшую (может я ее не заметил)
(no subject)
9/10/08 08:10 (UTC)Проблема в том, что вот это - бред: "IListSource.ContainsListCollection states it’s “indicating whether the collection is a collection of IList objects”.
А на самом деле это свойство обозначает совсем другое.
(no subject)
9/10/08 08:14 (UTC)я таки не понял, зачем было после этого утверждения какой-то пример приводить.
По-моему тут проблема не в описании, а в реализации этого свойства у конкретных классов/интерфейсов.
(no subject)
9/10/08 08:37 (UTC)(no subject)
9/10/08 09:05 (UTC)