This repository has been archived by the owner on Sep 25, 2023. It is now read-only.
/
Form1.cs
51 lines (44 loc) · 2.2 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
namespace Grid_IconRangeCondition {
public partial class Form1 : DevExpress.XtraEditors.XtraForm {
public Form1() {
InitializeComponent();
dashboardViewer1.CustomizeDashboardTitle += DashboardViewer1_CustomizeDashboardTitle;
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 rangeRule = new GridItemFormatRule(extendedPrice);
FormatConditionRangeSet rangeCondition =
new FormatConditionRangeSet(FormatConditionRangeSetPredefinedType.PositiveNegative3);
rangeRule.Condition = rangeCondition;
grid.FormatRules.AddRange(rangeRule);
}
private void DashboardViewer1_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e)
{
DashboardToolbarItem itemUpdate = new DashboardToolbarItem(
(args) => UpdateFormatting())
{
Caption = "Update Formatting",
};
e.Items.Add(itemUpdate);
}
private void UpdateFormatting() {
GridDashboardItem grid =
(GridDashboardItem)dashboardViewer1.Dashboard.Items["gridDashboardItem1"];
GridItemFormatRule rangeRule = grid.FormatRules[0];
FormatConditionRangeSet rangeCondition = (FormatConditionRangeSet)rangeRule.Condition;
RangeInfo range3 = rangeCondition.RangeSet[2];
range3.Value = 50;
range3.StyleSettings =
new IconSettings(FormatConditionIconType.DirectionalYellowUpInclineArrow);
RangeInfo range4 = new RangeInfo();
range4.Value = 75;
range4.StyleSettings =
new IconSettings(FormatConditionIconType.IndicatorCircledGreenCheck);
rangeCondition.RangeSet.Add(range4);
rangeRule.Condition = rangeCondition;
}
}
}