Serves as the data source for the nested List Views that display collection properties.
When an object is displayed in a Detail View, its collection properties are displayed via nested List Views. All the nested List Views that display collection properties, by default, use instances of the PropertyCollectionSource as data sources.
The PropertyCollectionSource introduces new members as compared to the CollectionSourceBase class. These members provide information on the object whose collection property the Collection Source represents. The following table lists them.
|PropertyCollectionSource.MasterObject||Provides access to the object, whose collection property is represented by the PropertyCollectionSource.|
|PropertyCollectionSource.MasterObjectType||Returns the type of the object whose collection property is represented by the PropertyCollectionSource.|
|PropertyCollectionSource.DeclaredType||Returns the type in which the collection property represented by the PropertyCollectionSource is declared.|
|PropertyCollectionSource.MemberInfo||Provides access to the IMemberInfo object that contains metadata information on the collection property represented by the PropertyCollectionSource.|
To create a PropertyCollectionSource instance, use the XafApplication.CreatePropertyCollectionSource method. There are several overloads of this method. If you use the one that does not include a dataAccessMode parameter, a value of the Application Model’s IModelListView.DataAccessMode property will be used to initialize the CollectionSourceBase.DataAccessMode property of the created collection source. Otherwise, use the overload with the dataAccessMode parameter. In this instance, the DataAccessMode property value from the Application Model will be ignored. By default, nested collections are created in Client mode, because their IModelListView.DataAccessMode property in the Application Model is set to Client.
If you want to create a Collection Source for a nested List View in Server, ServerView, InstantFeedback, or InstantFeedbackView mode, make sure that there is no logic for sorting, filtering or something else in the collection’s getter, and there are no subscribers to the collection’s events. This logic and subscribers won’t be taken into account, because a standalone server collection will be created instead of the original one.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the PropertyCollectionSource class.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.