Skip to main content
A newer version of this page is available. .

IDashboardControl.DashboardItemControlCreated Event

Allows you to access underlying WinForms controls.

Namespace: DevExpress.DashboardWin

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

NuGet Package: DevExpress.Win.Dashboard

Declaration

event DashboardItemControlCreatedEventHandler DashboardItemControlCreated

Event Data

The DashboardItemControlCreated event's data class is DashboardItemControlEventArgs. The following properties provide information specific to this event:

Property Description
CardControl Gets an underlying Card control.
ChartContext Gets the chart context.
ChartControl Gets an underlying chart control.
DashboardItemName Gets the component name of the dashboard item for which the event was raised.
DateFilterControl Gets an underlying date filter control.
GaugeContext Gets the gauge context.
GaugeControl Gets an underlying gauge control.
GridContext Gets the grid context.
GridControl Gets an underlying grid control.
MapControl Gets an underlying map control.
PictureEdit Gets an underlying picture edit control.
PivotGridControl Gets an underlying PivotGridControl.
RichEditControl Gets an underlying RichEdit control.
TreeMapControl Gets an underlying TreeMap control.

Example

This example demonstrates how to customize the controls used to visualize data in the dashboard items at runtime.

The following options are changed:

View Example: How to Access the Underlying Controls of the Dashboard Items

using DevExpress.XtraCharts;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraPivotGrid;
using System.Drawing;

namespace DashboardDesigner_ControlAccess
{
    public partial class DesignerForm1: DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public DesignerForm1() {
            InitializeComponent();
            dashboardDesigner.CreateRibbon();
            dashboardDesigner.LoadDashboard(@"..\..\Dashboards\dashboard1.xml");
        }

        private void dashboardDesigner_DashboardItemControlCreated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
            if(e.DashboardItemName == "pivotDashboardItem1") {
                PivotGridControl pivotGridControl = e.PivotGridControl;
                pivotGridControl.CustomCellValue += PivotGridControl_CustomCellValue; ;
            }
        }

        private void PivotGridControl_CustomCellValue(object sender, PivotCellValueEventArgs e) {
            if (e.RowField == null) return;
            if (e.GetFieldValue(e.RowField).ToString().Contains("Mountain"))
                e.Value = "###";
        }

        private void dashboardDesigner_DashboardItemControlUpdated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
            if(e.DashboardItemName == "gridDashboardItem1") {
                GridView gridView = e.GridControl.MainView as GridView;
                gridView.Appearance.Row.Font = new Font("Arial", 10);
            }
            if(e.DashboardItemName == "chartDashboardItem1") {
                ChartControl chartControl = e.ChartControl;
                ((XYDiagram)chartControl.Diagram).Panes[0].BackColor = Color.AliceBlue;
            }
        }

        private void dashboardDesigner_DashboardItemBeforeControlDisposed(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
            if(e.DashboardItemName == "pivotDashboardItem1") {
                PivotGridControl pivotGridControl = e.PivotGridControl;
                pivotGridControl.CustomCellValue -= PivotGridControl_CustomCellValue;
            }
        }
    }
}
See Also