-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port Winforms to CoreFX #22593
Comments
I'd rather have something new than WinForms, but I could not agree more on the eventual need for a platform-agnostic desktop UI. It's a rather obvious shortcoming. |
I'm glad to see the interest. We have heard interest from others for a UI solution with .NET Core, too. At present, we don't have any plans to build a cross-platform UI stack. We do think that .NET Core is a good base for such a project and encourage others to collaborate on that. We are focused on server apps currently and will likely add IoT apps to that next. |
The fact is that while Winforms could be considered obsolete it seems easy portable has been ported to Mono simply creating a wrapper of libGDI+ (the same thing is done here for System.Drawing), it exists a "try" to port Winforms to Net Core too: https://github.com/akoeplinger/mono-winforms-netcore. But having the backing of Microsoft after this will do make things different obviously! @jnm2 WPF has been proved impossible to port on Linux / MacOS (at least Mono never accomplished this), maybe Microsoft could make UWP portable? |
@fanoI It is not "easy". Porting apps from .NET Framework WinForms to Mono WinForms has been proved to be painful and projects (Plastic) finally drop WinForms to embrace OS native UI framework (such as Xamarin.Mac). Typical WinForms apps use many P/Invoke and third party controls, which can be quite difficult to port. WPF technically speaking can be ported to non-Windows OS, as its siblings such as XNA, Fire Monkey (for Delphi) have been ported. Mono never accomplishes that because they run out of resources, not because it cannot be done. There are other open source projects trying to port WPF over too, like Avalonia. Again, WPF apps can also use P/Invoke and third party controls. @jnm2 You should check out Xamarin.Forms, which goes cross platform (iOS/Android/UWP/Tizen right now, and macOS/WPF coming), but that's not "platform-agnostic". It maps UI elements to native controls automatically so your apps blend in just like native apps, not aliens everywhere as the horrible Java apps. It also supports embedding native controls if you do need that capability. Updated: Just wrote a blog post to cover most cross platform approaches and the frameworks that I know of. It is still far from the truth but hope it can get you familiar with the current status. |
Xamarin.Forms has a GUI wysiwyg designer as WPF and Winforms? |
@lextm I hate to write GUI code by hand... maybe I'm strange but I'm not interested if C#/VB.Net is automatically generated rather than XAML or well JSON but I want to design the windows graphically. Interesting analysis on the current situation in your blog post, thank you! @richlander the "port to core" label means that there is chance of this happening in the future? |
Instead of pushing WinForm, perhaps consider pushing Blend for Visual Studio 2017 to be compatible with XAML Standard |
Personally, if I had any time to spare, it would be fun to do a native UI library from the ground up with all desktop platforms in mind. I've done a fair bit of native windows UI interop and once in a while winforms has gotten in the way more than anything. But realistically, that's a huge amount of work which needs an experienced team. |
.Net Core will rock if it has WYSIWYG Designer and it does Android + Win/Mac/Linux Mind you the browser WebAssembly may change things? see Mono WebAssembly LLVM |
Winform exe's are cross platform, just launch with Mono runtime on linux/osx e.g. >mono ./hello.exe You can develop in Visual studio and run on linux/mac using mono runtime Prove it to yourself... Make a simple .sln Winform app, Target Dotnet 4.5. create form with button and label, create "hello world" to label on click event.
Copy same \bin\helloworld.exe to Linux/Mac/ Raspberry PI!!
OMG it renders the form just like windows, and all the managed .net framework stuff just works... To get latest version of mono for linux/mac
//To upgrade mono.
These UI frameworks below just confuse the simplicity of cross platform WYSIWYG Winform
Mono has Cross platform Winform Win/Linux/Mac, its just missing Android. |
I already put some work into this: https://github.com/yzrmn/System.CoreFX.Forms |
I'm trying to use @yzrmn Winform on Linux (Cent OS7), I had a problem with the wrong path of libX11 that should have resolved but now I've got this exception:
|
Yeah, it currently works on Windows only, there are things that need to be done to make Unix work aswell. I'm hoping for constributions on this part :) |
@fanol as you probably know we expect to ship this next year (blog) That's tracked by other means (and corefx side here https://github.com/dotnet/corefx/projects/5). Does this issue track anything else, or can you close it? |
But Winform / WPF / UWP will be only on Windows on Net Core 3, right? You are considering after having in Net Core to make them xplat? |
@fanol yes, it will be for Windows only (it's a straight port). We can leave this issue open to track the request for cross plat, if you like. |
Avalonia (https://github.com/AvaloniaUI/Avalonia) |
Yes, please, track multiplatform UI. |
Does .NET core currently have classes like System.Drawing.Icon or System.Drawing.Image for support with resx resource files generated on Windows to be in fact a way to render them on Winforms? I think working on this classes to make them work on all the listed platforms currently should be worth it first for resx files only. And then after that consider using the current Winforms like planned for core 3.0 and maybe under the hood maybe use some things like mono or any other frameworks like xarmin in core on non-windows platforms. If I was good at gui's by hand instead of just drag, drop, resize, set event functions for the stuff to do. I would go to things that makes the cpython tkinner module which is a widely supported UI framework for Unix. But is it supported on Android or iOS? I think an option is maybe find a platform independent unmanaged library that just works:tm: out of the box on Windows, Linux, Mac, Android, and iOS and then just simply p/invoke it on all platforms? Also unrelated but I contribute to a forms application that I am not sure will work with mono yet out of the box and not sure either if and now I can tell it's CI (appveyor) to try to build it with mono. However I might have to change the entire settings though on it to work. However if Core did have Windows forms applications like mine supported on all platforms and runs them like Windows does out of the box I would use Core on both Windows and Linux and simplify my entire build and setup on it. However with System.Drawing.Icon with it's tendency to display windows icons and maybe the fact that the windows icons file itself might be the thing hashed in the resx files. I think a better alternative for resx files is this: On Windows: when adding a ico file to a resx file just read all bit formats and sizes of the icon formats, convert to png, then add each png image as a entry to a image massfile (imf file) that is then saved into a resx file on for all platforms to use. Just on all platforms get the display bit depth and load the sizes asked for. This could be a new System.Drawing.Icon class for .NET Core. Pro: multi platform System.Drawing.Icon class for all platforms. |
I would like too WPF / UWP running on Linux / Mac OX but Winform is more likely they have ported already the Mono libgdi+ wrapper and System.Drawing so they have all the needed pieces to port Winform. If in the Net Core repository there will be really the sources of WPF / UWP (but I fear they will be only wrapper to the closed source Net Framework code) the community could try to make them xplat. |
I think that is eventually the plan of .net core devs and probably microsoft already. If so I got to do a few IsOSPlatform checks on some of my ui buttons (as some of them on my program should be enabled only on win32 as the programs they execute is a windows based game that I got no source code on. |
@fanoI Such a shame you named the title of this issue with WinForms. I do vote for having a UI rendering platform integrated as part of the .NET Core, and even as part of .NET Standard, but I'd want it to be structured like UWP or WPF, definitely not WinForms. You should have named it "Provide a comprehensive UI framework as part of the .NET Core". Please read this issue: |
@weitzhandler As much as I would like the .NET UI standard, not everyone should be forced to use XAML for their UI’s if they either: A: Do not know xaml well. Also I am not sure how one could manually Substitute the System.Windows.Forms.UserControl class to a xaml control (in case the user wants to convert a Windows Form/Form Control by hand). I think what it needs on documentations is a "C# xaml for dummies" type thing. Also what if the control uses "timers" like System.Windows.Form.Timer or even other things like the ContextMenuControl and the NotifyIcon control? Either way it is not clear in xaml standard yet for me what controls to port all the possible Windows Forms controls that is in the .NET framework 4.7.2 to what they would be under the xaml standard. Sure if more people probably had a guide they could possibly manually port their <form name>.Designer.cs, and <form name>.cs files by hand then. Also on xaml, is it like having the <form name>.Designer.cs file but it being a xml, and the other file remains semi unchanged or no? See this is unclear. If it is it could be feasible for me to move my forms and forms controls by converting their <form name/control name>.Designer.cs files and leaving the other files almost unchanged. Also if desired, since I cannot use my laptop currently to even test xaml with my project, one could fork it and test it on their end though (warning some winapi is used). https://github.com/Elskom/Els_kom_new/ |
@CatGirlsAreLife
|
Ah, I see. |
I agree with @fanoI. I suppose WinForms is still needed because they allow to very quickly create GUI applications for work not for admire. Many people that are not real developers, just engineers and hobbyists, able to contribute to our open source project because of WinForms. They will never get along with WPF or web development which are to complex for them. |
@2mik what allows the quick creation of GUI applications in WinForms is the designer, not the actual WinForms libraries, WinForms designer is just a hard-coded c# library that is mapping drag-and-drop input to c# code. with that said i completely refuse wasting efforts on porting a 15+ years old un-maintained library, and instead focus on porting the maintained and battle-tested wpf framework |
That's not correct - one can edit the c# code and ignore the designer. Though it's non-trivial. I agree that xaml would be better. Xamarinforms is cross platform including android, iOS, Linux etc. Again, however it isnt simple. |
I suggest you check out www.wisej.com Winform Apps in the browser. Amazing stuff. Buy me a beer later.. |
@bigworld12, I develop using both WinForms and WPF. WFP allows develop cool GUI. In real if you like creating clear layout, you have to edit XAML manually, like you do with HTML, that is difficult for inexperienced users. I work with guys whose primary skill is programming PLC. I'm sure they will never use WPF )) |
@fanoI if this is now tracking cross-platform UI perhaps you could clarify that in the title. |
In part my desire is realizing, Winform has been officially ported to Net Core: https://github.com/dotnet/winforms. There is WPF open sourced now too: https://github.com/dotnet/wpf. |
@fanoI, for wpf and winforms the contribution.md explicitly states that it won't accept a PR for xplat.
|
If I would want anything in .NET Core it would definitely not have been WinForms but rather WPF/UWP. Anyway, the truth is that I don't care so long as there will be a .NET UI Standard. |
@weitzhandler You need to differentiate between existing applications with existing WinForms UI, which people would like to go cross platform (possibly using the WinForms implementation of Mono) and new projects (where I definitely would vote against using WinForms). |
@fanoI Even if Microsoft won't take PRs for xplat WinForms/WPF, open sourcing the two allows whoever fond of that idea to fork and start their hacking immediately.
|
I'm going to close this issue as https://github.com/dotnet/winforms and https://github.com/dotnet/wpf are both now available, and there's no action to be taken in corefx. |
As the porting of System.Drawing from the Mono code is in progress what are the possibilities to have Winforms ported to CoreFX?
Not having an official supported portable GUI is the only single point in which Java is in advantage...
What do you think?
The text was updated successfully, but these errors were encountered: