Getting Started

  • 2 minutes to read

This guide describes how to create a .NET Core 3 application, configure it to use DevExpress WPF controls, and add the Spreadsheet control.

.net core spreadsheet getting started

Prerequisites

Create a New Project

Open Visual Studio 2019 v16.3 (or later) and create a new WPF Application (.NET Core).

.net core create wpf app

Right-click the project in the Solution Explorer, and select Edit Project File.

Set the UseWindowsForms key to true:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <UseWPF>true</UseWPF>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
</Project>
NOTE

A number of our products have a cross-platform core part which depends on Windows Forms assemblies, so setting the <UseWindowsForms> flag to true is necessary.

Add DevExpress Controls to Your Application

Get DevExpress WPF Controls for .NET Core

Via NuGet

  1. Obtain your NuGet feed URL.

  2. Go to Tools | NuGet Package Manager | Manage NuGet Packages for Solution

    .net core manage nuget packages

  3. Open "Settings"...

    .net core nuget settings

    ... and add a new NuGet feed with the following credentials:

    Name: DevExpress
    Source: https://nuget.devexpress.com/{your feed authorization key}/api

    .net core add nuget feed

  4. Select the DevExpress package source.

Via Installer

  1. Download and install the Unified Installer for .NET Core 3 Desktop Development.

    The installer creates a local NuGet feed with WPF controls for .NET Core.

  2. Go to Tools | NuGet Package Manager | Manage NuGet Packages for Solution
  3. Select the DevExpress .NET Core Desktop 20.2 Local package source.

Add Controls to Your Application

  1. In the "Browse" tab, search for the 'WindowsDesktop.Wpf' keyword and install the DevExpress.WindowsDesktop.Wpf and DevExpress.WindowsDesktop.Wpf.Themes.All packages for the current project. Accept the license agreement.

    .net core search wpf package

  2. Build the solution.

After you have added the DevExpress.WindowsDesktop.Wpf and DevExpress.WindowsDesktop.Wpf.Themes.All packages for the current project, and built the solution, the DevExpress WPF controls for .NET Core will appear in the Visual Studio Toolbox.

Add a Control

  1. Open MainWindow.xaml.

  2. Add the following DevExpress namespace reference:

    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"  
    
  3. Change Window to the ThemedWindow,

    <dx:ThemedWindow x:Class="DxWPFNetCoreApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
        xmlns:local="clr-namespace:DxWPFNetCoreApp"
        Title="MainWindow" Height="450" Width="800">
        <Grid>
    
        </Grid>
    </dx:ThemedWindow> 
    

    ... and in the code behind:

    using DevExpress.Xpf.Core;
    ...
    public partial class MainWindow : ThemedWindow {
        public MainWindow() {
            InitializeComponent();
        }
    }
    ...
    
  4. Drag the Spreadsheet control from the Visual Studio Toolbox to the XAML code. Change the application markup as follows:

    <dx:ThemedWindow x:Class="DxWPFNetCoreApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
        xmlns:dxsps="http://schemas.devexpress.com/winfx/2008/xaml/spreadsheet"
        xmlns:local="clr-namespace:DxWPFNetCoreApp"
        Title="MainWindow" Height="450" Width="800">
        <Grid>
            <dxsps:SpreadsheetControl CommandBarStyle="Ribbon" ShowFormulaBar="True"/>
        </Grid>
    </dx:ThemedWindow>
    
  5. Build and run the solution.