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

DashboardViewer.Initialized Event

Handle this event to get the dashboard item data, and apply master filter and dashboard state in asynchronous mode.

Namespace: DevExpress.DashboardWin

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

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

Declaration

public event EventHandler Initialized

Event Data

The Initialized event's data class is EventArgs.

Remarks

This event indicates that you can safely access dashboard items, and allows you to manage filters and the dashboard state.

Examples

This example demonstrates how to work in asynchronous mode to get filter values, set the master filter and perform an asynchronous task when the dashboard is loaded for the first time.

View Example: How to Get FIlter Values and Set Master Filter Asynchronously

using DevExpress.DashboardCommon.ViewerData;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RandomFilterExample
{
    public partial class ViewerForm1 : XtraForm {
        public ViewerForm1() {
            InitializeComponent();
            dashboardViewer1.Initialized += OnDashboardViewerInitialized;

        }
        async void OnMouseClick(object sender, MouseEventArgs e) {
            await RandomFilter();
        }
        async Task RandomFilter() {
            string itemName = "choroplethMapDashboardItem1";
            IList<AxisPointTuple> filters = await dashboardViewer1.GetAvailableFilterValuesAsync(itemName);
            Random r = new Random();
            int index = r.Next(0, filters.Count - 1);
            await dashboardViewer1.SetMasterFilterAsync(itemName, filters[index]);
        }

        async void OnDashboardViewerInitialized(object sender, EventArgs e) {
            await RandomFilter();
        }
    }
}

This example demonstrates how to get the data displayed in the dashboard item asynchronously when the dashboard is loaded.

View Example: How to Get Dashboard Item Data Asynchronously

using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
using System;
using System.Threading.Tasks;

namespace DataCounterExample
{
    public partial class ViewerForm1 : XtraForm {
        public ViewerForm1() {
            InitializeComponent();
            dashboardViewer1.Initialized += OnDashboardViewerInitialized;
            dashboardViewer1.MasterFilterSet += OnDashboardViewerMasterFilterSet;
            dashboardViewer1.MasterFilterCleared += OnDashboardViewerMasterFilterCleared;
        }

        async void OnDashboardViewerInitialized(object sender, EventArgs e) {
            simpleLabelItem1.Text = await GetLabelText("choroplethMapDashboardItem1", "Map");
            simpleLabelItem2.Text = await GetLabelText("gridDashboardItem1", "Grid");
        }

        async void OnDashboardViewerMasterFilterSet(object sender, MasterFilterSetEventArgs e) {
            simpleLabelItem2.Text = await GetLabelText("gridDashboardItem1", "Grid");
        }

        async void OnDashboardViewerMasterFilterCleared(object sender, MasterFilterClearedEventArgs e) {
            simpleLabelItem2.Text = await GetLabelText("gridDashboardItem1", "Grid");
        }

        async Task<string> GetLabelText(string itemName, string itemCaption) {
            var data = await dashboardViewer1.GetItemDataAsync(itemName);
            int count = data.GetAxisPoints(data.GetAxisNames()[0]).Count;
            return string.Format("{0}: {1}", itemCaption, count);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Initialized 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.

Implements

See Also