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

查看:204
本文介绍了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窗体控件,例如 DataGrid ToolBar ContextMenu 菜单 MainMenu MenuItem ,并删除了其子组件。



您需要使用 DataGridView ToolStrip ContextMenuSrtip MenuStrip 及其子组件。



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





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



对,设计时支持仍在开发中,某些控件和功能仍无法通过设计器获得。但是,如果您不想使用设计器,则只需要运行时支持,请使用.NET CORE 3.1支持的控件,但不提供设计时支持。



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



<在编写此答案时,如果您需要定期使用Designer,仍然不建议将应用程序移植到.NET Core。虽然VS 2019版本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天全站免登陆