Back to Devexpress

CardItemFormatRule Class

dashboard-devexpress-dot-dashboardcommon-094f26be.md

latest3.6 KB
Original Source

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.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
public class CardItemFormatRule :
    CardItemFormatRuleBase,
    IDataItemFormatRule
vb
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.

csharp
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);

Inheritance

Object DashboardItemFormatRule CardItemFormatRuleBase CardItemFormatRule

See Also

CardItemFormatRule Members

DevExpress.DashboardCommon Namespace