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

DashboardViewer.DataInspectorFormLoad Event

Occurs before the Data Inspector window displays. Allows you to access the window’s grid controls and change their settings.

Namespace: DevExpress.DashboardWin

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

NuGet Packages: DevExpress.Win.Dashboard, DevExpress.WindowsDesktop.Win.Dashboard

Declaration

public event DataInspectorFormLoadEventHandler DataInspectorFormLoad

Event Data

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

Property Description
AggregatedDataGrid Provides access to the Grid control that displays aggregated data in the Data Inspector dialog.
AllowExportAggregatedData Gets or sets whether end users can export aggregated data from the Data Inspector.
AllowExportRawData Gets or sets whether end users can export raw data from the Data Inspector.
DashboardItemName Gets the name of the dashboard item whose data is displayed in the Data Inspector window.
RawDataGrid Provides access to the Grid control that displays raw data in the Data Inspector dialog.

Remarks

Use the DashboardViewer.ShowDataInspector method to invoke the Data Inspector window.

When the Data Inspector window closes, the DashboardViewer.DataInspectorFormClosing event occurs.

Example

This example illustrates how to handle the DashboardViewer.DataInspectorFormLoad and DashboardViewer.DataInspectorFormClosing events to get access to the Grid controls in the Data Inspector window and change the grid settings.

You can modify the grid layout in the Data Inspector dialog. When the dialog closes, it calls the BaseView.SaveLayoutToStream method to save settings. When the dialog opens, the BaseView.RestoreLayoutFromStream method restores the settings.

View Example: How to Customize the Data Inspector Dialog

using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using DevExpress.DashboardWin;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;

namespace DataInspectorCustomizationExample {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm
    {
        Dictionary<string, Stream> aggregatedGridLayoutDictionary = new Dictionary<string, Stream>();
        Dictionary<string, Stream> rawGridLayoutDictionary = new Dictionary<string, Stream>();
        public Form1() {
            InitializeComponent();
            dashboardViewer1.AllowInspectAggregatedData = true;
            dashboardViewer1.AllowInspectRawData = true;
            dashboardViewer1.DataInspectorFormLoad += DashboardViewer1_DataInspectorFormLoad;
            dashboardViewer1.DataInspectorFormClosing += DashboardViewer1_DataInspectorFormClosing;
        }

        private void DashboardViewer1_DataInspectorFormClosing(object sender, DataInspectorFormClosingEventArgs e) {
            SaveGridLayout(e.DashboardItemName, e.AggregatedGrid.FocusedView, aggregatedGridLayoutDictionary);
            SaveGridLayout(e.DashboardItemName, e.RawGrid.FocusedView, rawGridLayoutDictionary);
        }
        private void DashboardViewer1_DataInspectorFormLoad(object sender, DataInspectorFormLoadEventArgs e) {
            CustomizeGrid(e.AggregatedGrid);
            CustomizeGrid(e.RawGrid);

            RestoreGridLayout(e.DashboardItemName, e.AggregatedGrid.FocusedView, aggregatedGridLayoutDictionary);
            RestoreGridLayout(e.DashboardItemName, e.RawGrid.FocusedView, rawGridLayoutDictionary);
        }
        void CustomizeGrid(GridControl grid) {
            GridView view = grid.MainView as GridView;
            view.OptionsCustomization.AllowGroup = true;
            view.OptionsView.ShowGroupPanel = true;
            view.OptionsBehavior.AutoExpandAllGroups = true;
        }
        void SaveGridLayout(string itemName, BaseView gridView, Dictionary<string, Stream> layouts) {
            MemoryStream str = new MemoryStream();
            gridView.SaveLayoutToStream(str);
            layouts[itemName] = str;
            str.Seek(0, SeekOrigin.Begin);
        }
        void RestoreGridLayout(string itemName, BaseView gridView, Dictionary<string, Stream> layouts) {
            Stream stream = null;
            if(layouts.TryGetValue(itemName, out stream)) {
                gridView.RestoreLayoutFromStream(stream);
                stream.Seek(0, System.IO.SeekOrigin.Begin);
            }
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DataInspectorFormLoad event.

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.

See Also