Back to Devexpress

DashboardDesigner.CustomDashboardItemControlCreating Event

dashboard-devexpress-dot-dashboardwin-dot-dashboarddesigner-305d53f5.md

latest4.7 KB
Original Source

DashboardDesigner.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
public event CustomDashboardItemControlCreatingEventHandler CustomDashboardItemControlCreating
vb
Public 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 DashboardDesigner1_CustomDashboardItemControlCreating(object sender, CustomDashboardItemControlCreatingEventArgs e){
            if(e.MetadataType == typeof(CustomFunnelMetadata))
          e.CustomControlProvider = new CustomFunnelControlProvider(dashboardDesigner1, dashboardDesigner1.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 DashboardDesigner1_CustomDashboardItemControlCreating(ByVal sender As Object, ByVal e As CustomDashboardItemControlCreatingEventArgs)
    If e.MetadataType Is GetType(CustomFunnelMetadata) Then
        e.CustomControlProvider = New CustomFunnelControlProvider((dashboardDesigner1, TryCast((dashboardDesigner1.Dashboard.Items(e.DashboardItemName), CustomDashboardItem(Of CustomFunnelMetadata)))
    End If
    End Sub
  End Class
End Namespace

Implements

CustomDashboardItemControlCreating

See Also

DashboardDesigner Class

DashboardDesigner Members

DevExpress.DashboardWin Namespace