Skip to main content
All docs
V22.1

CustomControlProviderBase Class

A base class that contains configuration settings for a custom control.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v22.1.Win.dll

Declaration

public abstract class CustomControlProviderBase :
    ICustomControlProvider,
    ICustomExportControlProvider

Remarks

A custom control displays a custom item in a dashboard. To configure the custom control, derive a class from CustomControlProviderBase. The class creates and updates the control based on data that a dashboard transfers to it.

The sections below illustrate how to implement a custom control:

Create a Custom Control

The CustomControlProviderBase.Control property gets the control displayed in a custom item.

The following code snippet derives a CustomFunnelControlProvider class from CustomControlProviderBase:

using System.Windows.Forms;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraCharts;
//...
public class CustomFunnelControlProvider : CustomControlProviderBase{
    CustomDashboardItem<CustomFunnelMetadata> dashboardItem;
    ChartControl chart;
    protected override Control Control { get { return chart; } }

    public CustomFunnelControlProvider(CustomDashboardItem<CustomFunnelMetadata> dashboardItem) {
        this.dashboardItem = dashboardItem;
        chart = new ChartControl();
    }
}

Update a Custom Control

The CustomControlProviderBase.UpdateControl(CustomItemData) method is called each time a custom item’s data or settings change. The method supplies data for a custom item based on measures and dimensions that are specified in metadata.

You can use one of the following ways to bind a control to data:

MultiDimensionalData
Use MultiDimensionalData if a custom control does not support data sources that implement IList. You can create a data source based on MultiDimensionalData for the control. Call the CustomItemData.GetMultiDimensionalData() method to get MultiDimensionalData.
DashboardFlatDataSource
Use DashboardFlatDataSource if a custom control supports a data source that implements IList. Call the CustomItemData.GetFlatData(DashboardFlatDataSourceOptions) method to get custom item data and bind it to a control.

The following code snippet binds data to a custom control:

using System.Windows.Forms;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraCharts;

public class CustomFunnelControlProvider : CustomControlProviderBase {
  CustomDashboardItem<CustomFunnelMetadata> dashboardItem;
  //...
  protected override void UpdateControl(CustomItemData customItemData){
    chart.Series.Clear();
    if(dashboardItem.Metadata.Value != null && dashboardItem.Metadata.Arguments.Count > 0) {
      Series series = new Series("A Funnel Series", ViewType.Funnel);
      flatData = customItemData.GetFlatData(new DashboardFlatDataSourceOptions() {
          AddColoringColumns = true });
      series.DataSource = flatData;
      series.ValueDataMembers.AddRange(dashboardItem.Metadata.Value.UniqueId);
      series.ArgumentDataMember = dashboardItem.Metadata.Arguments.Last().UniqueId;
      series.ColorDataMember = flatData.GetColoringColumn(dashboardItem.Metadata.Value.UniqueId).Name;
      chart.Series.Add(series);
    }
  }
}

Once you have configured a custom control and bound it to data, you need to visualize the control. To accomplish this, assign a CustomControlProviderBase derived class to the CustomDashboardItemControlCreatingEventArgs.CustomControlProvider property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomControlProviderBase class.

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.

Inheritance

Object
CustomControlProviderBase
See Also