WinForms: .NET 5 Design Time Enhancements

ctodx
01 July 2021

Before I describe our new WinForms .NET 5 designer and associated design-time experience, I think a word or two is needed about how we got here and why it took so long to address the needs of our loyal (and patient) WinForms developer community.

WinForms & .NET 5 – a Short Story

With the introduction of .NET Core 3, Microsoft chose to fundamentally alter Visual Studio’s design-time experience – from both a functional perspective and from a third-party implementation perspective. The biggest change to the design-time – and the only option for WinForms moving forward – involved the use of multi-platform code (.NET Core and standard .NET Framework) delivered as a NuGet package.

Microsoft opted to split the design-time into two distinct processes and to execute these processes via different development frameworks. The actual UI (controls and designer preview) now runs within the .Net Core process. Designer UI code or the code that allow components such as ours to be designed inside Visual Studio now runs under .NET Framework 4.6 (4.8). These processes require special message protocols for communication. Furthermore, interface elements used to edit component properties (along with component wizards) must run on the standard .NET Framework. And yes, designer code cannot reference or use actual control types – it can only access control properties using names via specialized proxies.

As you can probably guess, Microsoft’s decision essentially left us with three options:

  1. Sit tight and hope that Microsoft reverses course and addresses our needs. This did not happen.
  2. Rewrite the entire DevExpress design-time experience with standard controls and throw-away a decade or more of work. We were unwilling to compromise and completely unwilling to go this route.

Before we describe the third choice, a quick word about option #2. Setting aside the cost and time involved with this option, had we chosen this route, our unique WinForms design-time experience would have disappeared for good. For instance, all preview-related features within primary designers (such as our WinForms Grid Designer and our Charts Designer) would have never made it to .NET Core 3.

  1. Move our Designer UI into the .NET Core process.

Though option #3 introduced its own set of challenges (inter-process communications, etc), we chose it because it allowed us to share much of the same code base between the two major .NET frameworks. Additionally, this option gave us the ability to maintain design-time continuity between frameworks.

While we had hoped to release a major update late last year, breaking changes prevented us from doing so. The good news is that Microsoft completed its last major change (moving certain designer operations from the .NET Framework to .NET Core) in May with Visual Studio 2019 Build 16.10. Once Microsoft had officially released v16.10, we were in position to complete our redesign and deliver a relatively stable version of our .NET 5 WinForms designer.

DevExpress WinForms .NET 5 Design-Time – A Primer

[Note: To use our .NET 5 designer, you will need to install Visual Studio Build 16.10 or later alongside the .NET 5 Runtime. Of course, you will also need an active DevExpress product subscription (WinForms, DXperience, or Universal).]

Our most recent distribution (v21.1.4) includes a new DevExpress.Win.Design package. As you might surmise from the name, this package powers our Visual Studio .NET 5 design-time experience.

DevExpress.Win.Design will be installed automatically when you generate a new project using our WinForms Template Gallery. If you wish to update an existing app or create a blank project, you can install this package manually. To install manually, navigate to Visual Studio’s “Manage NuGet packages” dialog, select the DevExpress Local package feed, and install DevExpress.Win.Design from the "Browse" tab.

Installing DevExpress.Win.Design package via NuGet

This new package resolves numerous .NET 5 design-time issues and introduces new .NET 5 design-time options, including smart tag menu actions. To deliver this specific capability, we created custom smart tags for key UI elements (Grid columns, Ribbon Bar Items, etc.).

Custom dotNet5 Smart Tag
New Custom .NET 5 Smart Tag


dotNet5 App Template Gallery
.NET 5 Application Template Gallery


dotNET5 Data Grid Designer
.NET 5 Data Grid Designer

Limitations (unfortunately, there are some)

First, this package is only compatible with .NET 5 and does not offer design-time support for the older .NET Core 3.1 iteration.

Second, and perhaps most important, the design-time tools that rely upon Microsoft’s data source binding engine remain non-functional. This limitation cannot be sugar-coated. Without data source binding, you will not be able to create a new fully functional WinForms apps with our .NET Core designer. Yes, you will be able to construct your forms and customize UI controls as needs dictate, but you will not be able to create or assign a data source to your data-driven UI controls. This also means that you cannot auto-generate a user interface based on data (auto-generate columns, etc). To do this, you will still need to use .NET Framework 4.8.

Though we have tried our best to address this limitation, we have yet to find a reasonable workaround. We will continue to explore options in this regard and if we are able to address this matter independently from Microsoft, we will certainly share that information with all of you.

Note: This limitation does not apply to UI controls already bound to data (bound controls can be designed within the IDE).

Third, design-time docking is not yet functional: we have yet to rewrite the “docking-related” design-time code for .NET Core. Once we do, .NET Core design-time docking functionality will mirror its standard counterpart.

Getting Started

We have migrated all of our demos to .NET 5. You can now open any demo within Visual Studio (remember: v16.10 or later) and explore the capabilities of our .NET 5 design time.

The Future

As you can imagine, our new .NET Core Designer remains a work in progress. We cannot address all outstanding issues overnight – and some, like data-binding, may be impossible to work around – but we are working hard to address those matters that are under our direct control.

Your Feedback Matters

As always, we welcome your feedback and look forward to your suggestions. If you encounter an issue with our new .NET Core design-time experience, please submit a support ticket via the DevExpress Support Center. We will be more than happy to follow-up.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.