Skip to main content
A newer version of this page is available. .

Create a WPF Dashboard Viewer (.NET)

  • 3 minutes to read

This tutorial describes how to create the WPF application with the DashboardControl in .NET 5 (and .NET Core 3.1).

Prerequisites

Create a New Project

You can create a new .NET project in the console window or use Visual Studio’s template.

Create a New .NET Project in the Console Window

Open the console window and follow the steps below:

  1. Create and open a new folder. The folder name is the project name.

    mkdir NewCoreApp
    cd NewCoreApp
    
  2. Create a WPF project:

    dotnet new wpf
    
  3. Create a solution file:

    dotnet new sln
    
  4. Add the created .NET Core 3 project to this solution:

    dotnet sln add NewCoreApp.csproj
    

Open the created solution in Visual Studio.

Create a New .NET Project in Visual Studio

  1. In Visual Studio, create a new project and select WPF App on the start page as the project template.

  2. In the next dialog window, select the target framework.

Install the Dashboard Packages

  1. Right-click the Dependencies node in the Solution Explorer and select Manage NuGet Packages in the invoked context menu.

  2. Register the DevExpress NuGet feed as a package source and select it in the drop-down menu.

  3. Select the DevExpress NuGet feed as a package source drop-down list and go to the Browse page. Install the DevExpress.Wpf.Dashboard package.

The installed libraries are added to the project after the installation is completed.

Add a WPF Dashboard Viewer

Add the DashboardControl to the MainWindow.xaml file and build the solution.

<Window x:Class="NewWpfApp.MainWindow"
        ...
        xmlns:dxdash="http://schemas.devexpress.com/winfx/2008/xaml/dashboard">
    <Grid>
        <dxdash:DashboardControl/>
    </Grid>
</Window>

Use the DashboardControl.DashboardSource property to load an existing dashboard or follow the instructions below for information on how to create and edit a dashboard in a .NET Project.

Create and Edit a Dashboard in a .NET Project

The .NET Core 3.1 and .NET 5 projects do not support design-time dashboard creation. Add an auxiliary .NET Framework project to the solution and use the Visual Studio Designer to create a new dashboard or edit an existing one.

  1. In Visual Studio, add new WPF App (.Net Framework) to your solution.

  2. Right-click the auxiliary .NET project and choose Add | New DevExpress Item | Dashboard… in the context menu.

  3. Open and configure the dashboard. Follow this step-by-step tutorial for more information: How to create a dashboard in the Visual Studio Designer.

  4. Cut the added dashboard from the auxiliary project and paste it in the .NET Core 3 project.

  5. Add the dashboard and its namespace to the MainWindow.xaml file and build the solution.

    <Window x:Class="NewWpfApp.MainWindow"
            ...
            xmlns:axe="clr-namespace:MyAuxiliaryProject"
            xmlns:dxdash="http://schemas.devexpress.com/winfx/2008/xaml/dashboard">
        <Grid>
            <dxdash:DashboardControl DashboardSource="{x:Type axe:Dashboard1}"/>
        </Grid>
    </Window>
    

Run the application to open the dashboard in the WPF Dashboard Viewer.

Edit a Migrated Dashboard

You can edit your Dashboard in the auxiliary project’s designer. For this, add the Dashboard1.cs dashboard from the .NET Core 3 project to the auxiliary project as a link:

In the auxiliary project, double-click the Dashboard1.cs file to edit this dashboard in the Visual Studio Designer.

Limitations

Consider the following requirements when you design dashboards in an auxiliary .NET project for a .NET 5 (or .NET Core 3.1) project:

  • Synchronize connections between projects.

    If you store connections in the project’s configuration file, all new connections are saved to the auxiliary .NET project. Move the configuration file to the .NET Core 3 project and use a link to it in the auxiliary .NET project.

  • OLAP mode supports the ADOMD.NET data provider from v21.1.4.

    You can change the data provider type in the DashboardOlapDataSource.OlapDataProvider static property.