DashboardViewer.CustomDashboardItemControlCreating Event
Occurs when a dashboard control visualizes a custom item.
Namespace: DevExpress.DashboardWin
Assembly: DevExpress.Dashboard.v24.1.Win.dll
NuGet Package: DevExpress.Win.Dashboard
Declaration
public event CustomDashboardItemControlCreatingEventHandler CustomDashboardItemControlCreating
Event Data
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. |
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:
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 DashboardViewer1_CustomDashboardItemControlCreating(object sender, CustomDashboardItemControlCreatingEventArgs e){
if(e.MetadataType == typeof(CustomFunnelMetadata))
e.CustomControlProvider = new CustomFunnelControlProvider(dashboardViewer1, dashboardViewer1.Dashboard.Items[e.DashboardItemName] as CustomDashboardItem<CustomFunnelMetadata>);
}
}