dashboard-devexpress-dot-dashboardcommon-7e89006f.md
A format condition used to apply formatting according to predefined values.
Namespace : DevExpress.DashboardCommon
Assembly : DevExpress.Dashboard.v25.2.Core.dll
NuGet Package : DevExpress.Dashboard.Core
public class FormatConditionValue :
FormatConditionStyleBase
Public Class FormatConditionValue
Inherits FormatConditionStyleBase
To create a format condition to apply formatting according to predefined values, do the following.
Assign the resulting FormatConditionValue object to the DashboardItemFormatRule.Condition property.
The Value format condition (FormatConditionValue) allows you to compare dimension/measure values with predefined static values.
This example demonstrates how to apply conditional formatting to Grid cells whose values are greater than, less than or between the specified values.
using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
namespace Grid_FormatRules {
public partial class ValueConditionForm : XtraForm {
public ValueConditionForm() {
InitializeComponent();
Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
dashboardViewer1.Dashboard = dashboard;
GridDashboardItem grid = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
GridMeasureColumn extendedPrice = (GridMeasureColumn)grid.Columns[1];
GridItemFormatRule lessThanRule = new GridItemFormatRule(extendedPrice);
FormatConditionValue lessThanCondition = new FormatConditionValue();
lessThanCondition.Condition = DashboardFormatCondition.LessOrEqual;
lessThanCondition.Value1 = 100000;
lessThanCondition.StyleSettings =
new AppearanceSettings(FormatConditionAppearanceType.FontRed);
lessThanRule.Condition = lessThanCondition;
GridItemFormatRule betweenRule = new GridItemFormatRule(extendedPrice);
FormatConditionValue betweenCondition = new FormatConditionValue();
betweenCondition.Condition = DashboardFormatCondition.Between;
betweenCondition.Value1 = 100000;
betweenCondition.Value2 = 200000;
betweenCondition.StyleSettings =
new AppearanceSettings(FormatConditionAppearanceType.FontYellow);
betweenRule.Condition = betweenCondition;
GridItemFormatRule greaterThanRule = new GridItemFormatRule(extendedPrice);
FormatConditionValue greaterThanCondition = new FormatConditionValue();
greaterThanCondition.Condition = DashboardFormatCondition.GreaterOrEqual;
greaterThanCondition.Value1 = 200000;
greaterThanCondition.StyleSettings =
new AppearanceSettings(FormatConditionAppearanceType.FontGreen);
greaterThanRule.Condition = greaterThanCondition;
grid.FormatRules.AddRange(lessThanRule, betweenRule, greaterThanRule);
}
}
}
Imports Microsoft.VisualBasic
Imports System
Imports DevExpress.DashboardCommon
Imports DevExpress.XtraEditors
Namespace Grid_FormatRules
Partial Public Class ValueConditionForm
Inherits XtraForm
Public Sub New()
InitializeComponent()
Dim dashboard As New Dashboard()
dashboard.LoadFromXml("..\..\Data\Dashboard.xml")
dashboardViewer1.Dashboard = dashboard
Dim grid As GridDashboardItem = CType(dashboard.Items("gridDashboardItem1"), GridDashboardItem)
Dim extendedPrice As GridMeasureColumn = CType(grid.Columns(1), GridMeasureColumn)
Dim lessThanRule As New GridItemFormatRule(extendedPrice)
Dim lessThanCondition As New FormatConditionValue()
lessThanCondition.Condition = DashboardFormatCondition.LessOrEqual
lessThanCondition.Value1 = 100000
lessThanCondition.StyleSettings = New AppearanceSettings(FormatConditionAppearanceType.FontRed)
lessThanRule.Condition = lessThanCondition
Dim betweenRule As New GridItemFormatRule(extendedPrice)
Dim betweenCondition As New FormatConditionValue()
betweenCondition.Condition = DashboardFormatCondition.Between
betweenCondition.Value1 = 100000
betweenCondition.Value2 = 200000
betweenCondition.StyleSettings = New AppearanceSettings(FormatConditionAppearanceType.FontYellow)
betweenRule.Condition = betweenCondition
Dim greaterThanRule As New GridItemFormatRule(extendedPrice)
Dim greaterThanCondition As New FormatConditionValue()
greaterThanCondition.Condition = DashboardFormatCondition.GreaterOrEqual
greaterThanCondition.Value1 = 200000
greaterThanCondition.StyleSettings = New AppearanceSettings(FormatConditionAppearanceType.FontGreen)
greaterThanRule.Condition = greaterThanCondition
grid.FormatRules.AddRange(lessThanRule, betweenRule, greaterThanRule)
End Sub
End Class
End Namespace
Object FormatConditionBase FormatConditionStyleBase FormatConditionValue
See Also