.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

ListViewFilterAttribute Class

Specifies the filters that an end-user will be able to apply to the List View that displays the target class’objects.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v20.2.dll

Declaration

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct, AllowMultiple = true)]
public class ListViewFilterAttribute :
    Attribute
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = true)]
public class ListViewFilterAttribute :
    Attribute

Remarks

The following example demonstrates how to apply the ListViewFilter attribute:

using DevExpress.ExpressApp.Model;
using DevExpress.ExpressApp.SystemModule;
//...
[DefaultClassOptions]
[ListViewFilter("Today", "GetDate([DueDate]) = LocalDateTimeToday()")]
[ListViewFilter("In three days", @"[DueDate] >= ADDDAYS(LocalDateTimeToday(), -3) AND 
    [DueDate] < LocalDateTimeToday()")]
[ListViewFilter("In two weeks", @"[DueDate] >= ADDDAYS(LocalDateTimeToday(), -14) AND 
    [DueDate] < LocalDateTimeToday()")]
[ListViewFilter("The last week", @"GetDate([DueDate]) > LocalDateTimeLastWeek() AND 
    GetDate([DueDate]) <= ADDDAYS(LocalDateTimeLastWeek(), 5)")]
[ListViewFilter("This week", @"GetDate([DueDate]) > LocalDateTimeThisWeek() AND 
    GetDate([DueDate]) <= ADDDAYS(LocalDateTimeThisWeek(), 5)")]
public class Task : BaseObject {
   public Task(Session session) : base(session) {}
   private DateTime dueDate;
   [ModelDefault("EditMask","d")]
   public DateTime DueDate {
      get {
         return dueDate;
      }
      set {
         SetPropertyValue(nameof(DueDate), ref dueDate, value);      }
   }
}

The eXpressApp Framework is shipped with the SetFilter Action (see FilterController.SetFilterAction). This Action is displayed as a combo box, whose items represent filter captions. When an end-user selects an item, the current List View is filtered.

Read-OnlyParameters for List Views_Result

To add items to this Action, apply the ListViewFilter attribute to the business class whose List Views are to be filtered. Pass the required ListViewFilterAttribute.Caption, ListViewFilterAttribute.Criteria, ListViewFilterAttribute.Description and other filter details via the attribute’s parameters.

You can add as many ListViewFilter attributes as you wish to the target business class. The filters specified by these attributes will be loaded to the Application Model. The Filter child nodes will be added to the corresponding Views | <ListView> | Filters node. You can modify these filters via the Model Editor. In addition, you can add new filters via the Views | <ListView> | Filters node’s context menu. For details, refer to the Filters Application Model Node topic.

Inheritance

Object
Attribute
ListViewFilterAttribute
See Also