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.v21.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();
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the FormatConditionDateOccurring class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also