CollectionSourceBase.Criteria Property

Provides access to the Collection Source's CriteriaOperator dictionary that define the way in which the Collection Source's CollectionSourceBase.Collection is filtered.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public LightDictionary<string, CriteriaOperator> Criteria { get; }
Public ReadOnly Property Criteria As LightDictionary(Of String, CriteriaOperator)

Property Value

Type Description
DevExpress.ExpressApp.Utils.LightDictionary<String, CriteriaOperator>

A LightDicationary of the CriteriaOperator objects that define the way in which the Collection Source's CollectionSourceBase.Collection is filtered.

Remarks

To filter a Collection Source's collection, add the required CriteriaOperators to the Criteria dictionary. No additional methods have to be called. The dictionary holds <String, CriteriaOperator> pairs. The String contains the description of a criterion and the CriteriaOperator denotes the criterion. The LightDictionary class implements the IDictionary interface. So, you can use its methods and properties - Add, Clear, Count, Remove and others.

When the content of the Criteria dictionary is changed, the Collection Source's collection is filtered automatically. Two events are executed in the process - the CollectionSourceBase.CriteriaApplying and CollectionSourceBase.CriteriaApplied. Handle them to receive notifications when the Collection Source's collection is filtered.

A persistent object used in Collection Source's Criteria does not reload when the Object Space is refreshed, which raises the SessionMixingException exception. To avoid this, use a persistent object's key property instead of the object itself.

The following topics contain examples on accessing and manipulating the Criteria dictionary:

NOTE
  • In nested List Views, the Criteria is not directly applied to the associated collection. Instead, a separate collection is created, and the criteria are applied to it; the original associated collection is not modified. A nested List View in the Client data access mode with a disabled proxy collection (see XafApplication.DefaultCollectionSourceMode) is an exception. In this instance, the criteria are directly applied to the associated collection.

  • Currently, TreeListEditor has limited filtering capabilities. Only root tree nodes are filtered if you specify the Collection Source's Criteria property when filtering the List View.

See Also