WinForms and WPF controls support in .NET Core 3.0 | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (15)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (919)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (150)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Syncfusion .NET Core support

Syncfusion WinForms and WPF controls support in .NET Core 3.0

Overview

.NET Core 3.0 has been released, supporting Windows desktop applications on platforms such as Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Entity Framework 6. It also provides cross development among Windows Forms, WPF, and UWP, providing developers an opportunity to use the modern interfaces of UWP in Windows Forms and WPF. Overall, .NET Core 3.0 gives WinForms and WPF an easy access to benefit all its technology. To learn more about .NET Core 3.0, refer to these posts:

https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0

https://devblogs.microsoft.com/dotnet/net-core-3-and-support-for-windows-desktop-applications/

In this blog, I am going to walk through creating a WinForms .NET Core app that includes the Syncfusion DataGrid control. You can follow similar procedure to create WPF .NET Core app.

Prerequisites

The prerequisites for creating a .NET Core application are:

Creating a Windows Forms App (.NET Core)

Once the installation is done, we create a .NET Core WinForms application. In Visual Studio 2019, you can create a Windows Forms App (.NET Core) directly from the File > New Project > Create a new project dialog.

Creating a new Windows Forms App (.NET Core) project in Visual Studio 2019

Creating a new Windows Forms .NET Core App project in Visual Studio 2019

Open the project, remove the default template and then, include Syncfusion WinForms controls either using the NuGet package or by adding assembly references from the precompiled assemblies location. To learn more about Syncfusion WinForms controls’ NuGet packages and assembly references, refer to this documentation.

Precompiled Assembly Location: <system drive>:\Program Files (x86)\Syncfusion\Essential Studio\Windows\<Essential Studio: Installed Version>\precompiledassemblies\netcoreapp3.0

If you choose to install the required assemblies as a NuGet package, search for the Syncfusion.SfDataGrid.WinForms package and install it.

If you choose to add assemblies from the precompiled assemblies location, please add this list of assemblies:

  • Core.WinForms
  • Data.WinForms
  • DataSource.WinForms
  • GridCommon.WinForms
  • Licensing
  • SfDataGrid.WinForms
  • SfInput.WinForms
  • SfListView.WinForms
  • Shared.Base

Here, I have chosen the former way.

SfDataGrid NuGet package installed in the project

SfDataGrid NuGet package installed in the project

After installing the NuGet package, we initialize the WinForms DataGrid control and assign a data source in “Form1.cs”.

using System.Data;
using Syncfusion.WinForms.DataGrid;

namespace NETCoreWFDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            SfDataGrid sfDataGrid1 = new SfDataGrid();
            sfDataGrid1.Location = new System.Drawing.Point(5, 5);
            sfDataGrid1.Size = new System.Drawing.Size(1240, 1150);
            sfDataGrid1.DataSource = GetDataTable();
            this.Controls.Add(sfDataGrid1);
        }

        public DataTable GetDataTable()
        {
            DataTable employeeCollection = new DataTable();
            var dt = DateTime.Now;

            employeeCollection.Columns.Add("EmployeeID", typeof(int));
            employeeCollection.Columns[0].ColumnName = "Employee ID";
            employeeCollection.Columns.Add("EmployeeName", typeof(string));
            employeeCollection.Columns["EmployeeName"].ColumnName = "Employee Name";
            employeeCollection.Columns.Add("CustomerID", typeof(string));
            employeeCollection.Columns["CustomerID"].ColumnName = "Customer ID";
            employeeCollection.Columns.Add("Country", typeof(string));
            employeeCollection.Columns.Add("Date", typeof(DateTime));

            employeeCollection.Rows.Add(1001, "Belgim", "YHGTR", "US", new DateTime(dt.Year, dt.Month, dt.Day));
            employeeCollection.Rows.Add(1002, "Oliver", "LDON", "UK", new DateTime(dt.Year, dt.Month, dt.AddDays(-1).Day));
            employeeCollection.Rows.Add(1003, "Bernald", "ALFKI", "US", new DateTime(dt.Year, dt.Month, dt.AddDays(-5).Day));
            employeeCollection.Rows.Add(1004, "James", "YHGTR", "US", new DateTime(dt.Year, dt.Month, dt.AddDays(-1).Day));
            employeeCollection.Rows.Add(1005, "Beverton", "BERGS", "Europe", new DateTime(dt.Year, dt.Month, dt.Day));

            return employeeCollection;
        }
    }
}

On executing this project, we will get an output like this screenshot.

WinForms DataGrid bound to a DataTable

WinForms DataGrid bound to a DataTable

NOTE: Like WinForms applications, WPF .NET Core applications can also be created by choosing WPF App (.NET Core) in the Create a new project dialog. Once the project is created, you can add Syncfusion WPF controls following a similar procedure. Online help links are provided later to help you out in adding Syncfusion WPF controls.

Conclusion

In this blog, we have gone through the steps to create a Windows Forms App (.NET Core) and include the Syncfusion DataGrid control in it. You can try creating projects with other supported Syncfusion WinForms controls and WPF controls available and share your feedback with us through our support forumDirect-Trac, or our Feedback Portal.

If you are an existing customer, please download the new version of Essential Studio from the download page and try the .NET Core 3.0-supporting WinForms controls and their features for yourself. If you are a new customer, you can try our 30-day free trial to evaluate our controls.

Windows Forms Sample Link: https://github.com/SyncfusionExamples/.net-core-3.0-winforms-demo

WPF Sample Link: https://github.com/SyncfusionExamples/.net-core-3.0-wpf-demo

Online Help Links:

WinForms

https://help.syncfusion.com/windowsforms/nuget-packages

https://help.syncfusion.com/windowsforms/control-dependencies

https://help.syncfusion.com/windowsforms/add-syncfusion-controls

https://help.syncfusion.com/windowsforms/datagrid/gettingstarted

WPF

https://help.syncfusion.com/wpf/nuget-packages

https://help.syncfusion.com/wpf/control-dependencies

https://help.syncfusion.com/wpf/add-syncfusion-controls

https://help.syncfusion.com/wpf/sfdatagrid/getting-started

Tags:

Share this post:

Comments (4)

[…] Syncfusion WinForms and WPF controls support in .NET Core 3.0 (Hari Venkatesh E) […]

Christian Giesswein
Christian Giesswein

In case you want to see a live preview within Visual Studio 2019 with .NET Core and WPF just try out this extension https://marketplace.visualstudio.com/items?itemName=GiessweinApps.FAMLDesigner it supports all Syncfusion Controls!

Hello,
that’s a quick sample. But what about a real application with buttons, grids, texts… ? Visual studio designer is still in Preview. so we can’t design a Winforms .NET Core 3.x application ?

Hi Vincent,

Even though Windows Forms .NET Core App’s designer section is in preview mode, you can still use the common controls that you have posted in your update, to create a new application. There won’t be much of the changes from Microsoft further w.r.t the common controls they have. Even if it does, it will be minor and you can quickly adopt the changes on .NET Core version update.

NOTE: Syncfusion controls are not yet configured with respect to the toolbox, so please add our controls as stated above (through code behind).

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed