FormatConditionValue Class
A format condition used to apply formatting according to predefined values.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v19.1.Core.dll
Declaration
Remarks
To create a format condition to apply formatting according to predefined values, do the following.
- Specify the comparison logic by setting the FormatConditionValue.Condition property.
- Specify boundary values using the FormatConditionValue.Value1/FormatConditionValue.Value2 properties.
- Specify the required style settings applied to target elements using the FormatConditionStyleBase.StyleSettings property. You can change the color of dashboard item elements, font settings (AppearanceSettings) or add predefined icons (IconSettings).
Assign the resulting FormatConditionValue object to the DashboardItemFormatRule.Condition property.
Example
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-apply-conditional-formatting-to-grid-cells-using-the-value-format-condition-t259897.
Imports DevExpress.DashboardCommon
Namespace Grid_ValueCondition
Partial Public Class Form1
Inherits DevExpress.XtraEditors.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