The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
19.2 (EAP/Beta)
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DateFilterControl Class

A Date Filter control used to visualize a Date Filter dashboard item's data

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v19.1.Win.dll


public class DateFilterControl :
Public Class DateFilterControl
    Inherits XtraUserControl
    Implements IDashboardDateFilterControl,


Use the DashboardItemControlEventArgs.DateFilterControl property to access the DateFilterControl.


This example demonstrates how to access the underlying controls to customize the Date Filter dashboard item.

It changes the datepicker's caption, background color and paints selected dates and dates contained in the underlying data in a custom manner.


The complete sample project How to Customize the Date Filter Dashboard Item is available in the DevExpress Examples repository.

using DevExpress.DashboardCommon.ViewerData;
using DevExpress.DashboardWin;
using DevExpress.XtraEditors.Controls;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;

namespace DateFilter_Customization
    public partial class Form1 : DevExpress.XtraEditors.XtraForm
        DateTime minValue;
        DateTime maxValue;
        public Form1()
            this.Load += Form1_Load;
            dashboardViewer1.DashboardItemControlCreated += DashboardViewer1_DashboardItemControlCreated;
            dashboardViewer1.DashboardItemControlUpdated += DashboardViewer1_DashboardItemControlUpdated;
            dashboardViewer1.DashboardItemBeforeControlDisposed += DashboardViewer1_DashboardItemBeforeControlDisposed;

        private void Form1_Load(object sender, EventArgs e)

        private void DashboardViewer1_DashboardItemControlCreated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e)
            DashboardViewer designer = sender as DashboardViewer;

            if (e.DateFilterControl != null)
                e.DateFilterControl.BackColor = Color.AliceBlue;

        private void SubscribeDateFilterControlEvents(DateFilterControl dateFilter)
            dateFilter.CalendarFrom.CustomDrawDayNumberCell += Calendar_CustomDrawDayNumberCell;
            dateFilter.CalendarTo.CustomDrawDayNumberCell += Calendar_CustomDrawDayNumberCell;
            dateFilter.CustomDisplayText += DateFilter_CustomDisplayText;

        private void DateFilter_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
            e.DisplayText = (e.Value is DateTime) ? string.Format("{0:d}", e.Value) : "Click for the Date Picker";

        private void Calendar_CustomDrawDayNumberCell(object sender, DevExpress.XtraEditors.Calendar.CustomDrawDayNumberCellEventArgs e)
            CalendarControl calendar = sender as CalendarControl;

            if (e.Date > minValue && e.Date < maxValue)
                e.Style.BackColor = Color.FromArgb(80, 0, 100, 10);

            if (e.Selected && e.View == DateEditCalendarViewType.MonthInfo)
                StringFormat dayFormat = new StringFormat();
                dayFormat.Alignment = StringAlignment.Center;
                dayFormat.LineAlignment = StringAlignment.Center;
                Rectangle rect = e.ContentBounds;
                rect.Inflate(2, 2);
                Font cellFont = new Font(calendar.CalendarAppearance.DayCell.Font.FontFamily, calendar.CalendarAppearance.DayCell.Font.Size + 2);
                e.Cache.FillRectangle(new SolidBrush(Color.Yellow), e.ContentBounds);
                e.Cache.Graphics.DrawString($"{e.Date.Day}", cellFont, Brushes.Black, rect, dayFormat);
                e.Handled = true;

        private void DashboardViewer1_DashboardItemControlUpdated(object sender, DashboardItemControlEventArgs e)
            if (e.DateFilterControl != null)

        private void UpdateDateFilterControl(DateFilterControl dateFilter)
            MultiDimensionalData mddata = dashboardViewer1.GetItemData("dateFilterDashboardItem1");
            IList<DateTime> values = mddata.GetMeasures().Select(measure => mddata.GetValue(measure).Value).OfType<DateTime>().ToList();
            minValue = values.Min();
            maxValue = values.Max();

        private void UnsubscribeDateFilterControlEvents(DateFilterControl dateFilter)
            CalendarControl calendarTo = dateFilter.CalendarTo;
            CalendarControl calendarFrom = dateFilter.CalendarFrom;
            calendarFrom.CustomDrawDayNumberCell -= Calendar_CustomDrawDayNumberCell;
            calendarTo.CustomDrawDayNumberCell -= Calendar_CustomDrawDayNumberCell;

        private void DashboardViewer1_DashboardItemBeforeControlDisposed(object sender, DashboardItemControlEventArgs e)
            if (e.DateFilterControl != null)
See Also