All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DashboardItemControlEventArgs.GridContext Property

Gets the grid context.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v20.1.Win.dll

Declaration

public GridContext GridContext { get; }
Public ReadOnly Property GridContext As GridContext

Property Value

Type Description
GridContext

A context used to provide a connection between data item containers from the Columns section and underlying control's columns.

Remarks

The grid context provides the connection between dashboard data item containers from the Columns section and the underlying control's columns. The GetControlColumn method returns a data item container that corresponds to the specified control's column. The GetDashboardItemColumn method, in turn, gets a control's column that corresponds to the specified data item container from the Columns section.

For example, the Grid dashboard item has dimension, measure and delta columns (data item containers in the Columns section). In this case, the underlying Grid control also displays three columns: State, Sales (Sum) and Sales vs Target. The image below shows these elements that define Grid context:

When you pass the State data item container as the GetControlColumn method parameter, you get a GridColumn column in return:

On the contrary, if you pass one of the GridColumn object as the GetDashboardItemColumn method parameter, you get a column (a data item container from the Columns section) in the selected Grid dashboard item that corresponds this control's column:

The following code snippet shows how to set a back color for a Grid's measure column. The DashboardDesigner.DashboardItemControlUpdated event is used to update the Grid's appearance.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using System.Drawing;

// ...

private void DashboardDesigner1_DashboardItemControlUpdated(object sender, DashboardItemControlEventArgs e) {
    if(e.GridControl != null) {
        DashboardDesigner designer = (DashboardDesigner)sender;
        var gridDashboardItem = designer.Dashboard.Items[e.DashboardItemName] as GridDashboardItem;
        foreach(var dashGridColumn in gridDashboardItem.Columns) {
            if(dashGridColumn is GridMeasureColumn && dashGridColumn != null) {
                var column = e.GridContext.GetGridControlColumn(dashGridColumn);
                column.AppearanceCell.BackColor = Color.LightCyan;
            }
        }            
    }
}
See Also