All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

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.v20.1.Core.dll

Declaration

public class CardItemFormatRule :
    CardItemFormatRuleBase,
    IDataItemFormatRule
Public Class CardItemFormatRule
    Inherits CardItemFormatRuleBase
    Implements 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