Criteria Object Creation. Getting Started

In this lesson we will apply a filter to the Product objects in the Xafari Northwind demo. Then we will learn, how to activate for this objects the feature to use filters criteria as default value.

  • Set filters to the Product object as shown in the image below. Note, that you can also set filter in the CollectionSource.Criteria (in code) and in the GridView (in runtime). ListViewCriteriaObjectCreatingControllerWin process them all.

criteria_object_creating_3

  • Add module XafariModule to Module Project.
  • Invoke the Model Editor. Navigate to Views|Xafari.Northwind.Classifiers|Product_ListView|Columns|Discontinued node. Set UseByListViewCriteriaObjectCreating property to true.        

criteria_object_creating_4

Note, that you also can set UseByListViewCriteriaObjectCreating property for corresponding OwnMembers item in the BOModel node.

criteria_object_creating_5

The value of this property in the BOModel node is used as a default value in the Views node.

  • Now you can run applications, and see the result. You can go to Product_DetailView (Main|Classifiers|Product navigation item) and click New button.

criteria_object_creating_6

The Discounted property value set to true automaticaly, since the true value used as filtering criteria.