Skip to main content

FormatConditionTopBottom Class

A format condition used to apply formatting to top/bottom values.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v21.2.Core.dll

Declaration

public class FormatConditionTopBottom :
    FormatConditionStyleBase

Remarks

To create a format condition to apply formatting to top or bottom values, do the following.

Assign the resulting FormatConditionTopBottom object to the DashboardItemFormatRule.Condition property.

Example

The Top-Bottom (FormatConditionTopBottom) format conditions allow you to highlight a specific number of topmost/bottommost values. This example shows how to apply conditional formatting to the specified number of top/bottom values. The number of values can be specified as an absolute value or a percentage of all values.

The Average format condition (FormatConditionAverage) is used to highlight values above or below an average value.

View Example

using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
using System.Drawing;

namespace Grid_FormatRules {
    public partial class TopAverageConditionForm : XtraForm {
        public TopAverageConditionForm() {
            InitializeComponent();
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
            dashboardViewer1.Dashboard = dashboard;
            GridDashboardItem grid = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
            GridDimensionColumn salesPerson = (GridDimensionColumn)grid.Columns[0];
            GridMeasureColumn extendedPrice = (GridMeasureColumn)grid.Columns[1];

            GridItemFormatRule topRule = new GridItemFormatRule(extendedPrice, salesPerson);
            FormatConditionTopBottom topCondition = new FormatConditionTopBottom();
            topCondition.TopBottom = DashboardFormatConditionTopBottomType.Top;
            topCondition.RankType = DashboardFormatConditionValueType.Number;
            topCondition.Rank = 3;
            topCondition.StyleSettings = new IconSettings(FormatConditionIconType.IndicatorGreenCheck);
            topRule.Condition = topCondition;

            GridItemFormatRule bottomRule = new GridItemFormatRule(extendedPrice, salesPerson);
            FormatConditionTopBottom bottomCondition = new FormatConditionTopBottom();
            bottomCondition.TopBottom = DashboardFormatConditionTopBottomType.Bottom;
            bottomCondition.RankType = DashboardFormatConditionValueType.Percent;
            bottomCondition.Rank = 40;
            bottomCondition.StyleSettings = new IconSettings(FormatConditionIconType.IndicatorRedFlag);
            bottomRule.Condition = bottomCondition;

            GridItemFormatRule aboveAverageRule = new GridItemFormatRule(extendedPrice);
            FormatConditionAverage aboveAverageCondition = new FormatConditionAverage();
            aboveAverageCondition.AverageType = DashboardFormatConditionAboveBelowType.Above;
            aboveAverageCondition.StyleSettings = 
                new AppearanceSettings(Color.Green, FontStyle.Underline);
            aboveAverageRule.Condition = aboveAverageCondition;

            GridItemFormatRule belowAverageRule = new GridItemFormatRule(extendedPrice);
            FormatConditionAverage belowAverageCondition = new FormatConditionAverage();
            belowAverageCondition.AverageType = DashboardFormatConditionAboveBelowType.Below;
            belowAverageCondition.StyleSettings = 
                new AppearanceSettings(Color.Orange, FontStyle.Underline);
            belowAverageRule.Condition = belowAverageCondition;

            grid.FormatRules.AddRange(topRule, bottomRule, aboveAverageRule, belowAverageRule);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the FormatConditionTopBottom class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

See Also