Back to Devexpress

OptionsColumnFilter.AllowFilter Property

windowsforms-devexpress-dot-xtragrid-dot-columns-dot-optionscolumnfilter-369d720d.md

latest5.8 KB
Original Source

OptionsColumnFilter.AllowFilter Property

Gets or sets whether to display the filter button within the column’s header (field filter button in Layout Views).

Namespace : DevExpress.XtraGrid.Columns

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool AllowFilter { get; set; }
vb
<DefaultValue(True)>
<XtraSerializableProperty>
Public Overridable Property AllowFilter As Boolean

Property Value

TypeDefaultDescription
Booleantrue

true to display the filter button within the column’s header; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to AllowFilter
GridColumn

.OptionsFilter .AllowFilter

|

Remarks

The AllowFilter property specifies whether the filter button is visible for an individual column. To apply this setting to all columns, use the View’s OptionsCustomization.AllowFilter property.

csharp
// Display the filter button for all columns in gridView1.
gridView1.OptionsCustomization.AllowFilter = true;

// Hide the filter button for the ID column.
gridView1.Columns["ID"].OptionsFilter.AllowFilter = false;

Note

If the View’s OptionsCustomization.AllowFilter option is disabled, the column’s OptionsFilter.AllowFilter property has no effect.

When the View generates columns automatically from business objects, you can disable filter UI using the Display attribute’s AutoGenerateFilter property:

csharp
[Display(AutoGenerateFilter = false)]
public string Email { get; set; }
vb
<Display(AutoGenerateFilter:= False)>
Public Property Email() As String

See the following help topic for additional information: Data Annotation Attributes.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AllowFilter 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-how-to-add-an-unbound-column-to-gridlisteditor-to-execute-a-custom-action-for-a-record/CS/EFCore/ButtonInListEF/ButtonInListEF.Win/Controllers/SimpleBusinessActionGridListViewController.cs#L69

csharp
buttonColumn.OptionsColumn.ShowInCustomizationForm = false;
buttonColumn.OptionsFilter.AllowFilter = false;
InitButtonEditor(ref activeRepositoryItemButtonEdit, true);

winforms-grid-display-editors-in-columns-headers/CS/WindowsApplication1/Form1.cs#L35

csharp
gridColumn1.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False;
gridColumn1.OptionsFilter.AllowFilter = false;
new ColumnInplaceEditorHelper(gridColumn2, new RepositoryItemSpinEdit());

winforms-grid-display-editors-in-columns-headers/VB/Form1.vb#L34

vb
gridColumn1.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False
gridColumn1.OptionsFilter.AllowFilter = False
helper = New ColumnInplaceEditorHelper(gridColumn2, New RepositoryItemSpinEdit())

See Also

GridOptionsCustomization.AllowFilter

LayoutViewOptionsCustomization.AllowFilter

OptionsColumnFilter Class

OptionsColumnFilter Members

DevExpress.XtraGrid.Columns Namespace