Winforms (.NET Core 3) 是否支持所有 .NET Framework 控件 [英] Does Winforms (.NET Core 3) support all .NET Framework controls

查看:53
本文介绍了Winforms (.NET Core 3) 是否支持所有 .NET Framework 控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚转移到 .NET,我们正在尝试使用 C#/.NET 重新创建我们的一个旧项目,我们听说 .NET Core 是新项目的发展方向,我们非常有兴趣使用WinForms 为此,所以我一直在试验 Visual Studio 2019 预览版(16.5.0 预览版 2.0),但我注意到并非所有控件都显示在设计器中(我知道设计器刚刚添加到预览中),所以我尝试在 Form1.designer.cs 上手动添加控件,但我不确定这是否是正确的方法,或者我们应该等待更成熟的版本还是只使用 .NET Framework?PS:如果 .NET Core 更支持 WPF,我们也可以使用 WPF.

谢谢

解决方案

Winforms (.NET Core 3) 是否支持所有 .NET Framework 控件?

不,没有.事实上,在 .NET Core 3.1 中,一些过时的 Windows 窗体控件如 DataGridToolBarContextMenuMenuMainMenuMenuItem 和它们的子组件被移除.

您需要使用DataGridViewToolStripContextMenuSrtipMenuStrip 及其子组件.>

要查看已删除控件的列表和升级所需的操作,请查看:

我注意到并非所有控件都显示在设计器中

是的,设计时支持仍在开发中,一些控件和功能仍然无法通过设计器使用.但是,如果您不想使用设计器,您只需要运行时支持,请使用 .NET CORE 3.1 支持但没有设计时支持的控件.

我们应该等待更成熟的版本还是使用.NET Framework?

在撰写此答案时,如果您需要定期使用设计器,仍然不建议将您的应用程序移植到 .NET Core.虽然在 VS 2019 Version 16.5 Preview 1 中内置了设计器支持,但设计器仍在开发中,一些重要的功能如数据绑定、一些容器控件、本地化、MenuStrip 和 ToolStrip、视觉继承等都没有可用.

要查看正在开发的功能列表,请查看:

We have just moved to .NET and we are trying to recreate one of our old projects with C#/.NET, we have heard that .NET Core is the way to go for new projects and we are very much interested in using WinForms for this, so i have been experimenting with Visual Studio 2019 Preview (16.5.0 Preview 2.0), but i've noticed that not all the controls show up in the designer (i know the designer was just added to the preview), so i tried to add the controls manually on Form1.designer.cs, but im not really sure if this is the right way to do this or should we just wait for more mature releases or just use .NET Framework ? PS: We can go with WPF too if its more supported with .NET Core.

Thank you

解决方案

Does Winforms (.NET Core 3) support all .NET Framework controls?

No, it doesn't. In fact in .NET Core 3.1 some of the outdated Windows Forms controls like DataGrid, ToolBar, ContextMenu, Menu, MainMenu, MenuItem, and their child components were removed.

You need to use DataGridView, ToolStrip, ContextMenuSrtip, MenuStrip and their child components instead.

To see a list of removed controls and required actions for upgrade take a look at:

I've noticed that not all the controls show up in the designer

Right, the design-time support is still under development and some of the controls and feature are still not available through designer. However if you don't want to use designer, you just need run-time support, use the controls which are supported by .NET CORE 3.1 but don't have design-time support.

Should we just wait for more mature releases or just use .NET Framework?

At time of writing this answer, if you need to use designer on a regular basis, it's still not recommended to port your application to .NET Core. While there is builtin designer support in VS 2019 Version 16.5 Preview 1, but the designer is still under development and some important features like data-binding, some of container controls, localization, MenuStrip and ToolStrip, Visual inheritance and so on ate not available.

To see the list of under development features take a look at:

这篇关于Winforms (.NET Core 3) 是否支持所有 .NET Framework 控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆