Skip to main content

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

public class FormatConditionDateOccurring :
    FormatConditionStyleBase

Remarks

To create a format condition to apply formatting to the required date-time values, do the following.

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.

View Example

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