Skip to main content

CardItemFormatRule Class

A format rule that is calculated by data items and used to apply conditional formatting to the Card dashboard item.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.2.Core.dll

Declaration

public class CardItemFormatRule :
    CardItemFormatRuleBase,
    IDataItemFormatRule

Remarks

You can create a format rule that is calculated by hidden measures and series dimensions. These rules apply to all cards in the Card dashboard item. In code, you can also calculate a format rule by actual and target values. The rule applies to the card by whose value a rule is calculated.

Create the CardItemFormatRule object and specify its settings to add a format rule:

The following code snippet illustrates the format rule calculated by the actual value. The rule applies to cards whose actual value is between the Value1 and Value2 values.

using System.Windows.Forms;
using DevExpress.DashboardCommon;
using System.Drawing;

CardDashboardItem card = (CardDashboardItem)dashboardDesigner1.Dashboard.Items["cardDashboardItem1"];

CardItemFormatRule rule = new CardItemFormatRule();
rule.DataItem = card.Cards[0].ActualValue;
rule.ApplyToLayoutElement = CardFormatRuleLayoutElement.ActualValue;
FormatConditionValue value = new FormatConditionValue();
value.StyleSettings = new AppearanceSettings(Color.LightCoral, Color.DarkBlue);
value.Value1 = 50000;
value.Value2 = 70000;
value.Condition = DashboardFormatCondition.Between;
rule.Condition = value;
card.FormatRules.Add(rule);
See Also