Create a WPF Dashboard Application in .NET Core 3
- 3 minutes to read
This tutorial describes how to create the WPF application with the Dashboard control in .NET Core 3.
Prerequisites
- Core 3 SDK
- DevExpress .NET Core 3 Desktop Products
- DevExpress .NET Products v.20.1
- Visual Studio 2019 v16.3 or later
Create a New Project
You can create a new .NET Core project in the console window or use Visual Studio’s template.
Create a New .NET Core Project in the Console Window
Open the console window and perform the following steps:
Create and open a new folder. The folder name is the project name.
mkdir NewCoreApp cd NewCoreApp
Create a WPF project:
dotnet new wpf
Create a solution file:
dotnet new sln
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 Core Project in Visual Studio
- In Visual Studio, create a new project and select WPF App (.NET Core) on the start page as the project template.
Install Dashboard Packages
Right-click the Dependencies node in the Solution Explorer and select Manage NuGet Packages in the invoked context menu.
Register the DevExpress NuGet feed as a package source and select it in the drop-down menu.
Select the DevExpress NuGet feed as a package source drop-down list and go to the Browse page. Install the DevExpress.WindowsDesktop.Wpf.Dashboard package.
The installed libraries are added to the project after the installation is completed.
Add 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 provide an existing dashboard or follow the instructions below for information on how to create and edit a dashboard in Visual Studio.
Create and Edit a Dashboard in a .NET Core Project
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.
In Visual Studio, add new WPF App (.Net Framework) to your solution.
Right-click the auxiliary .NET project and choose Add | New DevExpress Item | Dashboard… in the context menu.
Open and configure the dashboard. Follow this step-by-step tutorial for more information: How to create a dashboard in the Visual Studio Designer.
Cut the added dashboard from the auxiliary project and paste it in the .NET Core 3 project.
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.