dashboard-devexpress-dot-dashboardwin-dot-idashboardcontrol-1be96756.md
Occurs when a dashboard control visualizes a custom item.
Namespace : DevExpress.DashboardWin
Assembly : DevExpress.Dashboard.v25.2.Win.dll
NuGet Package : DevExpress.Win.Dashboard
event CustomDashboardItemControlCreatingEventHandler CustomDashboardItemControlCreating
Event CustomDashboardItemControlCreating As CustomDashboardItemControlCreatingEventHandler
The CustomDashboardItemControlCreating event's data class is CustomDashboardItemControlCreatingEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| CustomControlProvider | Gets or sets a custom control that displays a custom dashboard item. |
| DashboardItemName | Gets the component name of the custom dashboard item. |
| MetadataType | Gets a custom item’s metadata type. |
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:
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>);
}
}
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.
this.dashboardControl = dashboardControl;
dashboardControl.CustomDashboardItemControlCreating += OnCustomDashboardItemControlCreating;
}
If dashboardControl IsNot Nothing Then
RemoveHandler dashboardControl.CustomDashboardItemControlCreating, AddressOf OnCustomDashboardItemControlCreating
End If
See Also