Back to Devexpress

IDashboardControl.CustomDashboardItemControlCreating Event

dashboard-devexpress-dot-dashboardwin-dot-idashboardcontrol-1be96756.md

latest6.1 KB
Original Source

IDashboardControl.CustomDashboardItemControlCreating Event

Occurs when a dashboard control visualizes a custom item.

Namespace : DevExpress.DashboardWin

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

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
event CustomDashboardItemControlCreatingEventHandler CustomDashboardItemControlCreating
vb
Event CustomDashboardItemControlCreating As CustomDashboardItemControlCreatingEventHandler

Event Data

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

PropertyDescription
CustomControlProviderGets or sets a custom control that displays a custom dashboard item.
DashboardItemNameGets the component name of the custom dashboard item.
MetadataTypeGets a custom item’s metadata type.

Remarks

The CustomDashboardItemControlCreating event fires each time a dashboard control visualizes a custom item. For example, when you add a custom item to a dashboard’s layout or open a saved dashboard with custom items added to the dashboard’s layout.

The event fires only for custom items whose metadata is registered in the CustomItemMetadataTypes collection.

Assign a CustomControlProviderBase class descendant to the CustomDashboardItemControlCreatingEventArgs.CustomControlProvider property. The CustomControlProviderBase object displays a custom item.

The following code snippet shows how to display a custom Funnel item:

csharp
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;

namespace CustomItemsSample {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            //...
        }
        private void DashboardControl1_CustomDashboardItemControlCreating(object sender, CustomDashboardItemControlCreatingEventArgs e){
            if(e.MetadataType == typeof(CustomFunnelMetadata))
          e.CustomControlProvider = new CustomFunnelControlProvider(dashboardControl1, dashboardControl1.Dashboard.Items[e.DashboardItemName] as CustomDashboardItem<CustomFunnelMetadata>);
        }
}
vb
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWin

Namespace CustomItemsSample
    Partial Public Class Form1
        Inherits Form
        Public Sub New()
            InitializeComponent()
      '...
    End Sub
    Private Sub DashboardControl1_CustomDashboardItemControlCreating(ByVal sender As Object, ByVal e As CustomDashboardItemControlCreatingEventArgs)
    If e.MetadataType Is GetType(CustomFunnelMetadata) Then
        e.CustomControlProvider = New CustomFunnelControlProvider((dashboardControl1, TryCast((dashboardControl1.Dashboard.Items(e.DashboardItemName), CustomDashboardItem(Of CustomFunnelMetadata)))
    End If
    End Sub
  End Class
End Namespace

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomDashboardItemControlCreating 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.

winforms-dashboard-custom-items-extension/CS/CustomItemExtension/CustomItems/Funnel/FunnelItemExtensionModule.cs#L24

csharp
this.dashboardControl = dashboardControl;
    dashboardControl.CustomDashboardItemControlCreating += OnCustomDashboardItemControlCreating;
}

winforms-dashboard-custom-items-extension/VB/CustomItemExtension/CustomItems/TreeList/TreeListItemExtensionModule.vb#L25

vb
If dashboardControl IsNot Nothing Then
    RemoveHandler dashboardControl.CustomDashboardItemControlCreating, AddressOf OnCustomDashboardItemControlCreating
End If

See Also

IDashboardControl Interface

IDashboardControl Members

DevExpress.DashboardWin Namespace