Skip to main content
All docs
V24.1

CardFormatRuleLayoutElement.CreateTextElement(String) Method

Creates a text layout element to which a format rule applies.

Namespace: DevExpress.DashboardCommon

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

NuGet Package: DevExpress.Dashboard.Core

Declaration

public static CardFormatRuleLayoutElement CreateTextElement(
    string text
)

Parameters

Name Type Description
text String

The text layout element’s display text.

Returns

Type Description
CardFormatRuleLayoutElement

The card’s text layout element.

Remarks

The following example shows how to apply the Value format rule to cards whose actual value is greater than the set condition value. The rule applies the green check icon to the card’s text layout element. The CreateTextElement method obtains the text layout element by the element’s display text.

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

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

CardItemDeltaFormatRule iconRule = new CardItemDeltaFormatRule();
iconRule.DeltaValueType = DeltaValueType.ActualValue;
iconRule.Card = cardItem.Cards[0];
FormatConditionValue valueCondition2 = new FormatConditionValue(DashboardFormatCondition.Greater, 1000000);
valueCondition2.StyleSettings = new IconSettings(FormatConditionIconType.IndicatorGreenCheck);
iconRule.Condition = valueCondition2;
CardFormatRuleLayoutElement text = CardFormatRuleLayoutElement.CreateTextElement("Sales: ");
iconRule.ApplyToLayoutElement = text;
cardItem.FormatRules.Add(iconRule);
See Also