Back to Devexpress

TreeList.ShowFilterPopupListBox Event

windowsforms-devexpress-dot-xtratreelist-dot-treelist-d7020817.md

latest4.3 KB
Original Source

TreeList.ShowFilterPopupListBox Event

Fires before a pop-up filter menu is displayed. Allows you to customize the value list.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[DXCategory("Behavior")]
public event FilterPopupListBoxEventHandler ShowFilterPopupListBox
vb
<DXCategory("Behavior")>
Public Event ShowFilterPopupListBox As FilterPopupListBoxEventHandler

Event Data

The ShowFilterPopupListBox event's data class is DevExpress.XtraTreeList.FilterPopupListBoxEventArgs.

Remarks

If the TreeListColumn.OptionsFilter.FilterPopupMode property is set to List , the pop-up filter menu contains a value list. You can handle the ShowFilterPopupCheckedListBox event to customize the list (for instance, disable or hide particular values).

Example

The following example shows how to remove default “(Blanks)” and “(Non blanks) items from the Name Column’s Filter DropDown.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraTreeList;

namespace ShowFilterPopupListBox_example
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void treeList1_ShowFilterPopupListBox(object sender, FilterPopupListBoxEventArgs e)
        {
            if (e.Column.FieldName == "Name")
            {
                //Removes "(Blanks)"
                e.ComboBox.Items.RemoveAt(0);
                //Removes "(Non blanks)"
                e.ComboBox.Items.RemoveAt(0);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.table1TableAdapter.Fill(this.treelistdbDataSet.Table1);

        }
    }
}
vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraTreeList

Namespace ShowFilterPopupListBox_example
    Partial Public Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub treeList1_ShowFilterPopupListBox(ByVal sender As Object, ByVal e As FilterPopupListBoxEventArgs) Handles treeList1.ShowFilterPopupListBox
            If e.Column.FieldName = "Name" Then
                'Removes "(Blanks)"
                e.ComboBox.Items.RemoveAt(0)
                'Removes "(Non blanks)"
                e.ComboBox.Items.RemoveAt(0)
            End If
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            Me.table1TableAdapter.Fill(Me.treelistdbDataSet.Table1)

        End Sub
    End Class
End Namespace

See Also

ShowFilterPopupCheckedListBox

Filtering

Classic Style

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace