Skip to content

Port Winforms to CoreFX #22593

Closed
Closed

Description

@fanoI

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?

Activity

  1. jnm2 commented on Jul 3, 2017

    @jnm2
    Contributor

    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.

  2. richlander commented on Jul 3, 2017

    @richlander
    Member

    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.

  3. fanoI commented on Jul 3, 2017

    @fanoI
    Author

    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?

  4. lextm commented on Jul 3, 2017

    @lextm

    @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.

  5. fanoI commented on Jul 3, 2017

    @fanoI
    Author

    Xamarin.Forms has a GUI wysiwyg designer as WPF and Winforms?

  6. lextm commented on Jul 4, 2017

    @lextm

    @fanoI Not exactly but close. It has a previewer now.

  7. fanoI commented on Jul 4, 2017

    @fanoI
    Author

    @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.
    All the modern .Net UI frameworks are a step back respect to Winforms too in this aspect.

    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?

  8. richlander commented on Jul 4, 2017

    @richlander
    Member

    @fanoI There is a chance. I think that @karelz added that label because that's the category of the work. I don't think he added it as an endorsement or the like. As I said, it isn't something we are focused on at the moment.

  9. JimSEOW commented on Aug 11, 2017

    @JimSEOW

    Instead of pushing WinForm, perhaps consider pushing Blend for Visual Studio 2017 to be compatible with XAML Standard

  10. jnm2 commented on Aug 11, 2017

    @jnm2
    Contributor

    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.

  11. Opzet commented on Feb 22, 2018

    @Opzet

    .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

  12. Opzet commented on Feb 22, 2018

    @Opzet

    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.

    1. On Windows, click or launch from command line compiled file in solution from \bin

    helloworld,exe
    presto click button, -> hello world of course, works as expected

    Copy same \bin\helloworld.exe to Linux/Mac/ Raspberry PI!!

    1. To launch app on Linux/Mac, just prefix it with mono and use the './' before exe

    Mono ./helloworld.exe
    presto click button, -> hello world IT WORKS!

    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
    Check version.

    mono --version
    //Mono should be >=v5.0.1

    //To upgrade mono.

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

    echo "deb http://download.mono-project.com/repo/debian jessie main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

    sudo apt-get update
    sudo apt-get install mono-complete


    These UI frameworks below just confuse the simplicity of cross platform WYSIWYG Winform

    • Xamarin.Forms :(
    • UWP IOT :(
    • GTK# :(

    Mono has Cross platform Winform Win/Linux/Mac, its just missing Android.

  13. yzrmn commented on Apr 22, 2018

    @yzrmn

    I already put some work into this: https://github.com/yzrmn/System.CoreFX.Forms
    Contributions would be very welcome!

  14. fanoI commented on May 4, 2018

    @fanoI
    Author

    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:

    Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.WindowsFormsSynchronizationContext' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "keyboards.resources" was correctly embedded or linked into assembly "System.CoreFX.Forms" at compile time, or that all the satellite assemblies required are loadable and fully signed.

  15. yzrmn commented on May 4, 2018

    @yzrmn

    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 :)

  16. 13 remaining items

  17. bigworld12 commented on Aug 31, 2018

    @bigworld12

    @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.
    the difference between winforms and wpf, is that in wpf you can actually edit the GUI as a xaml + drag-and-drop designer but in winforms you are only limited to the drag-and-drop designer.

    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

  18. devmikew commented on Aug 31, 2018

    @devmikew

    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.

  19. Opzet commented on Aug 31, 2018

    @Opzet

    I suggest you check out www.wisej.com

    Winform Apps in the browser. Amazing stuff.

    Buy me a beer later..

  20. 2mik commented on Aug 31, 2018

    @2mik

    @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 ))

  21. danmoseley commented on Aug 31, 2018

    @danmoseley
    Contributor

    @fanoI if this is now tracking cross-platform UI perhaps you could clarify that in the title.

  22. fanoI commented on Dec 5, 2018

    @fanoI
    Author

    In part my desire is realizing, Winform has been officially ported to Net Core: https://github.com/dotnet/winforms.
    For now the code is Windows only but the question is as there is an already Mono version of it the two will be merged so to have a real xplat version of Winform?

    There is WPF open sourced now too: https://github.com/dotnet/wpf.
    In this case the question is: Microsoft will take the effort to make it xplat or at least will accept community PR to make this possible?

  23. DickvdBrink commented on Dec 5, 2018

    @DickvdBrink
    Contributor

    @fanoI, for wpf and winforms the contribution.md explicitly states that it won't accept a PR for xplat.

    https://github.com/dotnet/wpf/blob/3a696bc4fcfe4b8dd65ee856c9a089fa0ce13235/Documentation/contributing.md

    We also do not intend to accept contributions that provide cross-platform implementations for Windows Forms or WPF.

  24. weitzhandler commented on Dec 5, 2018

    @weitzhandler
    Contributor

    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.

  25. markusschaber commented on Dec 5, 2018

    @markusschaber

    @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).

  26. lextm commented on Dec 5, 2018

    @lextm

    @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.

    If we all waited for Microsoft to ship .NET for Linux and mobile, we shouldn't have seen Mono and Xamarin.

  27. stephentoub commented on Mar 13, 2019

    @stephentoub
    Member

    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.

  28. transferred this issue fromdotnet/corefxon Jan 31, 2020
  29. added this to the 3.0 milestone on Jan 31, 2020
  30. ghost locked as resolved and limited conversation to collaborators on Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Metaenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions