DateFilterControl.CalendarFrom Property
Provides access to the Calendar control that displays the key date in the Date Filter range.
Namespace: DevExpress.DashboardWin
Assembly: DevExpress.Dashboard.v24.2.Win.dll
Declaration
Property Value
Type | Description |
---|---|
CalendarControl | A CalendarControl that allows the end-user to select the range’s date or time. |
Remarks
The CalendarFrom property provides access to a calendar that is always visible in the date picker drop-down panel, regardless of the DateFilterDashboardItem.FilterType setting. If the FilterType is set to the DateFilterType.Between value, the CalendarFrom property provides access to the calendar that displays the range’s start.
Example
This code snippet paints selected dates and dates contained in the underlying data in a custom manner.
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