Skip to main content Skip to footer

Introducing WinForms Controls for .NET 5 - CTP

.NET 5 is the convergence of .NET Framework and .NET Core. With this, Microsoft is unifying APIs and runtime of all development platforms. We have been collaborating with Microsoft to make the controls compatible, and we are pleased to announce the community preview of .NET 5 controls for WinForms.

Read more about ComponentOne .NET 5 CTP

These controls are supported with the preview version of Visual Studio 2019. We are working to officially release these controls soon after .NET 5 is released for production use.

We aim to keep the API compatible with the .NET 4.x version to a high degree. While existing applications can continue to leverage our .NET Framework 4.5.2 controls, to support .NET Core 3.1, these .NET 5 controls do not compromise on architecture.

To take advantage of the newer features in .NET 5, we have refactored legacy code and removed support for old visual styles.

These controls are available as NuGet packages, which can be used for preview purposes. Please note that the controls should not be used in production as .NET 5 is itself in preview.

What’s Included in Preview

For the initial preview, we are releasing the following controls:

  • FlexGrid
  • FlexChart
  • Ribbon
  • C1Icon
  • Sparkline
  • ExpressionEditor
  • RulesManager
  • Themes

Getting Started With .NET 5

To use the .NET 5 controls, you'll need the latest preview of Visual Studio 2019. The preview version can be installed here.

Please note that the preview version of Visual Studio 2019 has a limited form of designer support. Presently, the ComponentOne controls do not support the designer. However, all controls will have designer support whenever Microsoft completes the designer implementation.

In this walkthrough, we'll create the DataTable sample of FlexGrid that is available in .NET Framework 4.5.2 version.

  • Open Visual Studio 2019 preview and create a .NET Core WinForms app. The project is by default .NET 5, this can be confirmed from project properties:

  • Add C1.Win.FlexGrid package from NuGet
  • Open Form1.cs and initialize FlexGrid control in the form load event.

    C1.Win.FlexGrid.C1FlexGrid fg = new C1.Win.FlexGrid.C1FlexGrid();
    this.Controls.Add(fg);
    fg.Dock = DockStyle.Fill;
    
  • Next, create the data table and add data:

private DataTable GetData()
        {

            DataTable _dt = new System.Data.DataTable("MyDataTable");
            _dt.Columns.Add("Name", typeof(string));
            _dt.Columns.Add("Age", typeof(int));
            _dt.Columns.Add("Gender", typeof(Gender));
            _dt.Columns.Add("Status", typeof(MaritalStatus));

            // populate it
            _dt.Rows.Add(new object[] { "Joe", 12, Gender.Male, MaritalStatus.Single });
            _dt.Rows.Add(new object[] { "Bob", 14, Gender.Male, MaritalStatus.Single });
            _dt.Rows.Add(new object[] { "Sue", 13, Gender.Female, MaritalStatus.Single });
            _dt.Rows.Add(new object[] { "Chris", 26, Gender.Male, MaritalStatus.Unknown });
            _dt.Rows.Add(new object[] { "Frank", 12, Gender.Male, MaritalStatus.Single });
            _dt.Rows.Add(new object[] { "Rob", 18, Gender.Male, MaritalStatus.Single });
            _dt.Rows.Add(new object[] { "Sara", 23, Gender.Female, MaritalStatus.Single });
            _dt.Rows.Add(new object[] { "Rick", 28, Gender.Male, MaritalStatus.Unknown });
            return _dt;
        }

        public enum MaritalStatus
        {
            Single,
            Married,
            Separated,
            Widow,
            Deceased,
            Unknown
        }
        public enum Gender
        {
            Male,
            Female,
        }
  • Next, data bind the FlexGrid in the form load event: fg.DataSource=this.GetData();

Like previous versions, this is all that is needed to configure the FlexGrid control and bind it to data.

Samples

We have ported some samples for each control that we have added. We have also added a Showcase sample for FlexGrid where features like editors, datamap, custom columns, grouping, row detail, conditional formatting through rules manager, column selector, column footer, filtering, and searching have been demonstrated:

The samples are located in the samples folder of WinForms studio: ~\Documents\ComponentOne Samples\WF\

.NET 5 Summary

The current preview has a limited set of controls and a beta license, valid until January 31, 2021. Afterward, the controls will not function.

In the next iteration (the 2020 v3 release) we plan to add more controls, including all Input controls, InputPanel, and other FlexGrid features based on your feedback and usage.

This will be the first official release of the control set and will contain licensing.

Prabhakar Mishra

Prabhakar Mishra

Product Manager
comments powered by Disqus