WCF Data Services

  • 2 min to read

The Items Source Configuration Wizard allows you to bind the PivotGridControl to data using WCF Data Services. This topic guides you through the steps needed to do this.

  1. Click the PivotGridControl's smart tag and select the Items Source Wizard command.

    WpfPivot_ProvidingData_SmartTag

  2. In the invoked Items Source Configuration Wizard, select WCF Data Services...

    ItemsSourceConfigurationWizard_Wcf

    ... and click the New Data Source button placed within the Data Sources area.

    DataSourceConfigurationWizard_SelectAdoNet_NewDataSource

  3. The following message will appear.

    ItemsSourceConfigurationWizard_RebuildWarning

    Click OK.

  4. Specify the address of a data service.

    Pivot_AddWCFService

    To learn how to create a WCF data service, see the following topics: Creating the Data Service.

    IMPORTANT

    After you create a service reference, rebuild the solution.

  5. After creating a data source, click Items Source Wizard again.

    WpfPivot_ProvidingData_SmartTag

  6. In the invoked Items Source Configuration Wizard, select the created service.

    ItemsSourceConfigurationWizard_Wcf_SelectModel

    Click Next.

  7. On the next page, select the required binding method.

    ItemsSourceConfigurationWizard_EF_SelectBindingMethod

    Select Simple Binding and click Next.

  8. On the final page, specify the service URI (Service Root) and click the Test Connection button.

    ItemsSourceConfigurationWizard_Wcf_Finish

    Then, select the required Table and click Finish.

  9. The PivotGridControl will be bound to the created data source.

    WpfPivot_BoundToDataSet

    You can now use the Retrieve Fields command to retrieve the available data source fields.

    NOTE

    Note that the Items Source Configuration Wizard adds the created data source to window resources.

    <dx:DXWindow.Resources>
            <dx:WcfSimpleDataSource x:Key="WcfSimpleDataSource" ContextType="{x:Type ServiceReference1:NorthwindEntities}" Path="SalesPersons" ServiceRoot="http://localhost:65455/Northwind.svc/">
            </dx:WcfSimpleDataSource>
        </dx:DXWindow.Resources>
    

    Then, the PivotGridControl is bound to the created data source.

    <dxpg:PivotGridControl DataSource="{Binding Data, Source={StaticResource WcfSimpleDataSource}}"/>