Skip to main content

TreeList.ShowFilterPopupDate Event

Allows you to customize a column’s dropdown calendar before it is displayed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v23.2.dll

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

Declaration

[DXCategory("Behavior")]
public event FilterPopupDateEventHandler ShowFilterPopupDate

Event Data

The ShowFilterPopupDate event's data class is DevExpress.XtraTreeList.FilterPopupDateEventArgs.

Remarks

If the OptionsColumnFilter.FilterPopupMode property is set to Date, the Column’s Filter DropDown is displayed as a calendar. In this mode, you can handle the ShowFilterPopupDate event to customize the dropdown (for instance, disable or hide particlar items). This event is raised each time before the filter dropdown is displayed.

Example

The following example shows how to add a new item to the Hired Column’s Filter DropDown.

Example ShowFilterPopupDate

using System;
using System.Windows.Forms;
using DevExpress.XtraTreeList;
using DevExpress.Data.Filtering;


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

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

        private void treeList1_ShowFilterPopupDate(object sender, FilterPopupDateEventArgs e)
        {
            if (e.Column.FieldName != "Hired") return;
            DateTime firstDayOfFirstYear = new DateTime(1982, 1, 1);
            DateTime lastDayOfFirstYear = new DateTime(1982, 12, 31);

            CriteriaOperator firstDay = new BinaryOperator(
                e.Column.FieldName, firstDayOfFirstYear, BinaryOperatorType.GreaterOrEqual);
            CriteriaOperator lastDay = new BinaryOperator(
                e.Column.FieldName, lastDayOfFirstYear, BinaryOperatorType.Less);
            CriteriaOperator crit = new GroupOperator(GroupOperatorType.And, firstDay, lastDay);

            e.List.Add(new DevExpress.XtraEditors.FilterDateElement("Year of Foundation", "", crit));

        }
    }
}
See Also