System.Windows.Forms has been moved to .NET Core and is now available in the form of a NuGet package.
It seems Microsoft has specifically listed the components that haven't been moved over:
https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls
I need to migrate use of the charting functionality in:
using System.Windows.Forms.DataVisualization.Charting;
When I use the drawing functionality of the base control class I get the following error:
The type 'Control' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=4.0.0.0
When I go to the definition of the Charts class it shows:
public class Chart :Forms.Control
With the keywords before the colon recognized, but not after.
So somehow the Forms.Control isn't available, yet the code compiles...
The following features where taken from the base Control class and are now no longer avialable:
- BeginInit; Start putting in graph components
- EndInit; Done putting in graph components
- Update; Visually show the graph on screen
- SaveImage; Write graph visuals to a memory stream
How can these features be implemented in .NET CORE?
Since System.Windows.Forms has been migrated to .NET Core I added a using to it to my code, this doesn't help.
I installed the NuGet package for Microsoft.Windows.Compatibility, this didn't help either.
Edit:
I've installed the following NuGet packages:
System.Windows.Forms.DataVisualization 1.0.0-prerelease.20110.1
System.Drawing.Common 4.7.0
Microsoft.Windows.Compatibility 3.1.0
I've tried to install the latest preview version but this tries to upgrade all kinds of dependencies to 5.0.0-preview.1.20120.5, which cannot be found.
The following properties have been added the following properties to my .csproj
<UseWpf>true</UseWpf>
<UseWindowsForms>true</UseWindowsForms>