Back to Devexpress

Remove Data Providers from the Data Source Wizard

xtrareports-119927-desktop-reporting-wpf-reporting-end-user-report-designer-for-wpf-api-and-customization-remove-data-providers-from-the-report-wizard.md

latest7.5 KB
Original Source

Remove Data Providers from the Data Source Wizard

  • Sep 03, 2025
  • 3 minutes to read

This help topic explains on how to customize data providers list in the Data Source Wizard.

Remove Data Providers at Design Time

You can customize various Data Source and Report Wizard options at design time using the DataSourceWizardSettings property. The SqlWizardSettings.AvailableDataProviders property allows you to select which data providers are displayed on the “Select a Data Connection Type” page.

The following XAML code demonstrates how to specify this setting:

xaml
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:dxrud="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner" 
        xmlns:dxda="http://schemas.devexpress.com/winfx/2008/xaml/dataaccess"
        Title="MainWindow" >
    <dxrud:ReportDesigner DataSourceWizardSettings="{dxda:DataSourceWizardSettings 
            SqlWizardSettings={dxda:SqlWizardSettings AvailableDataProviders=MSSqlServer}}">
    </dxrud:ReportDesigner>
</Window>

Remove Data Providers at Runtime

The example customizes the Report Wizard and Data Source Wizard to achieve the following:

  • Display ChooseDataProviderPage (“Select a Data Connection Type”) as the start page.

  • Restrict available SQL data source providers to MSSQLServer, Oracle, Amazon Redshift, MySQL, Postgres, and SQLite.

View Example: Customize the Data Providers List

Customization Service

To customize Data Source and Report Wizards, create a customization service (MyWizardCustomizationService in this example) that implements the IWizardCustomizationService interface.

CustomizeDataSourceWizard and CustomizeReportWizard methods contain main logic for wizard customization:

  • StartPage - sets the initial wizard page to ChooseDataProviderPage (“Select a Data Connection Type”).
  • ReportType - specifies the report type in the report model.
  • DataSourceType - specifies the data source type in the report model.

The CustomizeProviders method limits available data source types and providers to a predefined list.

csharp
// ...
// Customization service for the Data Source and Report wizards.
public class MyWizardCustomizationService : IWizardCustomizationService {

    static readonly string[] allowedSqlDataSourceProviders = new[] {
        "MSSqlServer", "Oracle", "Amazon Redshift", "MySql", "Postgres", "SQLite"
    };
    // Modifies the Data Source wizard's start page and data source type. 
    void IDataSourceWizardCustomizationService.CustomizeDataSourceWizard(DataSourceWizardCustomizationModel customization, ViewModelSourceIntegrityContainer container) {
        if(customization.StartPage == typeof(ChooseExistingConnectionPage<IDataSourceModel>)) {
            customization.Model.DataSourceType = DataSourceType.Xpo;
            customization.StartPage = typeof(ChooseDataProviderPage<IDataSourceModel>);
        }
        CustomizeProviders(container);
    }
    // Modifies the Report wizard's start page, data source type, and report type.
    void IWizardCustomizationService.CustomizeReportWizard(ReportWizardCustomizationModel customization, ViewModelSourceIntegrityContainer container) {
        if (customization.StartPage == typeof(ChooseReportTypePage<XtraReportModel>)) {
            customization.Model.ReportType = ReportType.Standard;
            customization.Model.DataSourceType = DataSourceType.Xpo;
            customization.StartPage = typeof(ChooseDataProviderPage<XtraReportModel>);
        }
        CustomizeProviders(container);
    }
    // ...
    // Filters available SQL data source providers and registers allowed providers in the container.
    static void CustomizeProviders(IntegrityContainer container) {
        var providers = container.Resolve<List<ProviderLookupItem>>();
        providers.RemoveAll(x => !allowedSqlDataSourceProviders.Contains(x.ProviderKey));
        container.RegisterInstance<DataSourceTypes>(new DataSourceTypes(WizardDataSourceType.Sql));
    }
}
vb
' ...
' Customization service for the Data Source and Report wizards.
Public Class MyWizardCustomizationService
    Implements IWizardCustomizationService

    Private Shared ReadOnly allowedSqlDataSourceProviders() As String = { "MSSqlServer", "Oracle", "Amazon Redshift", "MySql", "Postgres", "SQLite" }
    ' Modifies the Data Source wizard's start page and data source type. 
    Private Sub IDataSourceWizardCustomizationService_CustomizeDataSourceWizard(ByVal customization As DataSourceWizardCustomizationModel, ByVal container As ViewModelSourceIntegrityContainer) Implements IDataSourceWizardCustomizationService.CustomizeDataSourceWizard
        If customization.StartPage Is GetType(ChooseExistingConnectionPage(Of IDataSourceModel)) Then
            customization.Model.DataSourceType = DataSourceType.Xpo
            customization.StartPage = GetType(ChooseDataProviderPage(Of IDataSourceModel))
        End If
        CustomizeProviders(container)
    End Sub
    ' Modifies the Report wizard's start page, data source type, and report type.
    Private Sub IWizardCustomizationService_CustomizeReportWizard(ByVal customization As ReportWizardCustomizationModel, ByVal container As ViewModelSourceIntegrityContainer) Implements IWizardCustomizationService.CustomizeReportWizard
        If customization.StartPage Is GetType(ChooseReportTypePage(Of XtraReportModel)) Then
            customization.Model.ReportType = ReportType.Standard
            customization.Model.DataSourceType = DataSourceType.Xpo
            customization.StartPage = GetType(ChooseDataProviderPage(Of XtraReportModel))
        End If
        CustomizeProviders(container)
    End Sub
    ' ...
    ' Filters available SQL data source providers and registers allowed providers in the container.
    Private Shared Sub CustomizeProviders(ByVal container As IntegrityContainer)
        Dim providers = container.Resolve(Of List(Of ProviderLookupItem))()
        providers.RemoveAll(Function(x) Not allowedSqlDataSourceProviders.Contains(x.ProviderKey))
        container.RegisterInstance(Of DataSourceTypes)(New DataSourceTypes(WizardDataSourceType.Sql))
    End Sub
End Class

Service Registration

The ReportDesigner.ServicesRegistry property registers the MyWizardCustomizationService type in XAML and applies customization logic.

xaml
<dxrud:ReportDesigner x:Name="reportDesigner">
    <dxrud:ReportDesigner.ServicesRegistry>
        <dxda:TypeEntry ServiceType="{x:Type dxrudw:IWizardCustomizationService}" ConcreteType="{x:Type local:MyWizardCustomizationService}" />
    </dxrud:ReportDesigner.ServicesRegistry>
</dxrud:ReportDesigner>

See Also

Wizard Customization Overview

Register a Custom Page in the Report Wizard