Back to Devexpress

XPBaseCollection.Criteria Property

xpo-devexpress-dot-xpo-dot-xpbasecollection-89600bec.md

latest6.5 KB
Original Source

XPBaseCollection.Criteria Property

Gets or sets the criteria used to filter objects on the data store side.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public CriteriaOperator Criteria { get; set; }
vb
Public Property Criteria As CriteriaOperator

Property Value

TypeDescription
CriteriaOperator

A CriteriaOperator object that specifies the criteria to filter objects on the data store side.

|

Remarks

Use the Criteria property in order to change the criteria by which the persistent objects will be filtered during collection loading on the storage side. If you change this property’s value, the collection is refreshed immediately. But if you change any of its criteria members, you must call the XPBaseCollection.Reload method in order to force loading. To temporarily prevent a collection from loading/reloading data use the XPBaseCollection.LoadingEnabled property.

For examples and additional information about filter expressions, see these help topics:

Note

Unlike the XPCollection’s XPBaseCollection.Filter, Criteria can be built on persistent properties only.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Criteria property.

Note

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.

xaf-filter-lookup-list-views/CS/XPO/FilterLookup/FilterLookup.Module/BusinessObjects/Order.cs#L62

csharp
// Show only Global Accessories when the Product is not specified
    availableAccessories.Criteria = CriteriaOperator.Parse("[IsGlobal] = true");
}

winforms-filtercontrol-implement-ifilteredcomponent/CS/Q200298/Helper.cs#L176

csharp
if (source == null) return null;
    return source.Criteria;
}

XAF-search-objects-using-complex-criterion/CS/Dennis.Search.Win/SearchObjectBase.cs#L100

csharp
criteriaCore = null;
    searchResultsCore.Criteria = EmptyCollectionCriteria;
}

XPO_how-to-filter-a-collection-by-an-associated-objects-properties-e886/CS/Form1.cs#L302

csharp
void SetFilter(CriteriaOperator criteria) {
    xpCollection1.Criteria = criteria;

asp-net-mvc-grid-custom-binding-and-xpo/CS/XPCustomBindingExample/XPO/XpoBindingHandlers.cs#L31

csharp
XPCollection data = new XPCollection(Session, ClassInfo);
data.Criteria = CriteriaOperator.Parse(e.FilterExpression) & GetGroupFilter(e.GroupInfoList);
data.Sorting = GetSorting(e.State.SortedColumns, e.StartDataRowIndex != 0 || e.DataRowCount != 0);

winforms-filtercontrol-implement-ifilteredcomponent/VB/Q200298/Helper.vb#L219

vb
If sourceField Is Nothing Then Return Nothing
    Return sourceField.Criteria
End Get

XAF-search-objects-using-complex-criterion/VB/Dennis.Search.Win/SearchObjectBase.vb#L155

vb
criteriaCore = Nothing
    searchResultsCore.Criteria = EmptyCollectionCriteria
End Sub

XPO_how-to-filter-a-collection-by-an-associated-objects-properties-e886/VB/Form1.vb#L292

vb
Private Sub SetFilter(ByVal criteria As CriteriaOperator)
    xpCollection1.Criteria = criteria

asp-net-mvc-grid-custom-binding-and-xpo/VB/XPCustomBindingExample/XPO/XpoBindingHandlers.vb#L31

vb
Dim data As New XPCollection(Session, ClassInfo)
data.Criteria = CriteriaOperator.Parse(e.FilterExpression) And GetGroupFilter(e.GroupInfoList)
data.Sorting = GetSorting(e.State.SortedColumns, e.StartDataRowIndex <> 0 OrElse e.DataRowCount <> 0)

See Also

Filter

XPBaseCollection Class

XPBaseCollection Members

DevExpress.Xpo Namespace