Back to Devexpress

FilterControl.FilterColumns Property

windowsforms-devexpress-dot-xtraeditors-dot-filtercontrol-040f4ec0.md

latest3.6 KB
Original Source

FilterControl.FilterColumns Property

Gets a filter column collection.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[Browsable(false)]
public FilterColumnCollection FilterColumns { get; }
vb
<Browsable(False)>
Public ReadOnly Property FilterColumns As FilterColumnCollection

Property Value

TypeDescription
DevExpress.XtraEditors.Filtering.FilterColumnCollection

A DevExpress.XtraEditors.Filtering.FilterColumnCollection object that represents the collection of filter columns.

|

Remarks

When a source control is assigned to the FilterControl.SourceControl property, the FilterColumns collection is automatically populated with the source control’s columns. By default, the FilterControl.SortFilterColumns property is set to true , and this ensures that the created columns in the collection will be sorted by captions in ascending order. Subsequent changes to the FilterControl.SortFilterColumns property don’t re-sort the column collection.

A FilterControl supports unbound mode. When the control is not bound to any source control, it still allows an end-user to construct filter criteria. In this instance, columns must be added to the FilterColumns collection manually via the FilterControl.SetFilterColumnsCollection method.

The following example demonstrates how to create unbound filter columns:

csharp
using DevExpress.XtraEditors.Filtering;
using DevExpress.XtraEditors.Repository;
using DevExpress.Data.Filtering.Helpers;

private void CreateFilterColumns() {
    filterControl1.FilterColumns.Add(new UnboundFilterColumn("Name", "Field1", typeof(string), new RepositoryItemTextEdit(), FilterColumnClauseClass.String));
    filterControl1.FilterColumns.Add(new UnboundFilterColumn("Age", "Field2", typeof(int), new RepositoryItemSpinEdit(), FilterColumnClauseClass.Generic));
}
vb
Imports DevExpress.XtraEditors.Filtering
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.Data.Filtering.Helpers

Private Sub CreateFilterColumns()
    filterControl1.FilterColumns.Add(New UnboundFilterColumn("Name", "Field1", GetType(String), New RepositoryItemTextEdit(), FilterColumnClauseClass.String))
    filterControl1.FilterColumns.Add(New UnboundFilterColumn("Age", "Field2", GetType(Integer), New RepositoryItemSpinEdit(), FilterColumnClauseClass.Generic))
End Sub

Run Demo

See Also

SetFilterColumnsCollection

SortFilterColumns

FilterControl Class

FilterControl Members

DevExpress.XtraEditors Namespace