FormatConditionDateOccurring Class
A format condition used to apply formatting to date-time values concerning a specific date and/or date interval relative to today.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v24.2.Core.dll
Declaration
Remarks
To create a format condition to apply formatting to the required date-time values, do the following.
- Specify a filter that identifies specific dates or date intervals using the FormatConditionDateOccurring.DateType property.
- Specify the required style settings applied to target elements using the FormatConditionStyleBase.StyleSettings property. You can change the color of dashboard item elements, font settings (AppearanceSettings) or add predefined icons (IconSettings).
Assign the resulting FormatConditionDateOccurring object to the DashboardItemFormatRule.Condition property.
Example
The Date Occurring format condition (FormatConditionDateOccurring
) allows you to apply formatting to date-time values of a specific date and/or date interval relative to today.
This example demonstrates how to apply conditional formatting to Grid cells whose values fall into one of the predefined intervals.
using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
namespace Grid_FormatRules {
public partial class DateOccurringForm : XtraForm {
public DateOccurringForm() {
InitializeComponent();
dashboardViewer1.AsyncDataLoading += OnDashboardViewerAsyncDataLoading;
dashboardViewer1.DataSourceOptions.ObjectDataSourceLoadingBehavior = DevExpress.DataAccess.DocumentLoadingBehavior.LoadAsIs;
Dashboard dashboard = new Dashboard();
dashboard.LoadFromXml(@"..\..\Data\DashboardDate.xml");
dashboardViewer1.Dashboard = dashboard;
GridDashboardItem grid = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
GridDimensionColumn date = (GridDimensionColumn)grid.Columns[0];
GridItemFormatRule dateOccurringRule = new GridItemFormatRule(date);
FormatConditionDateOccurring dateOccurringCondition = new FormatConditionDateOccurring();
dateOccurringCondition.DateType = FilterDateType.MonthAgo1 | FilterDateType.MonthAgo2;
dateOccurringCondition.StyleSettings =
new AppearanceSettings(FormatConditionAppearanceType.PaleOrange);
dateOccurringRule.Condition = dateOccurringCondition;
dateOccurringRule.ApplyToRow = true;
grid.FormatRules.Add(dateOccurringRule);
}
void OnDashboardViewerAsyncDataLoading(object sender, DataLoadingEventArgs e) {
e.Data = DataGenerator.CreateData();
}
}
}