DateFilterControl.CalendarTo Property

Provides access to the Calendar control that displays the additional date in the Date Filter range.

Namespace: DevExpress.DashboardWin

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

Declaration

public CalendarControl CalendarTo { get; }

Property Value

Type Description
CalendarControl

A CalendarControl that allows the end-user to select the range’s date or time.

Remarks

The CalendarTo property provides access to a calendar that is visible in the date picker drop-down panel only when the DateFilterDashboardItem.FilterType property is set to the DateFilterType.Between value.

Example

This code snippet paints selected dates and dates contained in the underlying data in a custom manner.

View Example: How to Customize the Date Filter Dashboard Item

using DevExpress.DashboardWin;
using DevExpress.XtraEditors.Controls;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
// ...
    dashboardViewer1.DashboardItemControlCreated += DashboardViewer1_DashboardItemControlCreated;
// ...
    private void DashboardViewer1_DashboardItemControlCreated(object sender, DashboardItemControlEventArgs e)
    {
        if (e.DateFilterControl != null)
        {
            e.DateFilterControl.CalendarFrom.CustomDrawDayNumberCell += Calendar_CustomDrawDayNumberCell;
            e.DateFilterControl.CalendarTo.CustomDrawDayNumberCell += Calendar_CustomDrawDayNumberCell;
        }
    }

    DateTime minValue;
    DateTime maxValue;

    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;
        }
    }
See Also