Skip to content
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

[Discussion] Avalonia Newbie, WPF Expert : Migrating a Large NetCore WPF Business Application to Avalonia #4542

Closed
jtbrower opened this issue Aug 22, 2020 · 14 comments

Comments

@jtbrower
Copy link

Hello Everyone

Hello everyone, my name is Jason, I am walking into an "serious" Avalonia trial with 13 years of non-stop WPF experience and around a 4-6 week evaluation of WinUI 3. I am exited about Avalonia, yet crossing my fingers that its not an illusion because it just seems to good to be true (take that as a compliment). I am hoping that I can migrate a rather large touch-screen business application that has grown over the last 11-12 years.

History

Since 2012 when UWP came out and Microsoft urged the WPF developers to migrate to UWP, I have felt disappointed that they didn't give us the tools we needed to start that migration journey. As each year passed by, I was excited for the Build Conference announcements, thinking that surely they would give us a way to write full trust applications (with more than one Window) in a XAML framework that had rendering performance on par with the then new UWP.

As most of us know, without outside help, WinUI 3 preview 1 in 2020 was really the first announcement that gave us hope that we could perform that migration. Since I have craved rendering performance improvements since the day I switched from Windows Forms, I suppose I have grown to be a bit more eager than I would have otherwise felt. That eagerness puts me in a position where I am willing to take more risk, accept more effort, just to modernize the UI.

Although I tried my best to force WinUI 3.0 preview-1 and 2 to provide features a WPF developer expects, there are too many barriers, unknowns, and still no production release date. Still no ability to show more than a single Window. No ability to use Window transparency without making the entire Windows contents transparent too. I have full respect for the developers on that team, but the cancellation of the September preview led to a desire to evaluate Uno and Avalonia. Considering Avalonia seems closer to WPF, I am hoping for it to be the winner.

What I am Hoping for

I have been migrating a huge codebase from .Net to NetCore and now Net5.0 since the preview days of NetCore 1. With this version of my company's application, the number one goal has been to avoid outside schedule pressure and await Microsoft to release improvements that we have desired for so long. I kept pushing the UI to the side to give time for Microsoft or third parties to craft a better UI framework.

I truly only have two hard requirements for a WPF replacement or improvement.

  1. Clear indications that the framework isn't in Maintenance Mode
  2. Second is rendering performance.

Since the first is self-explanatory, I will talk about rendering. Although I write business applications, they are usually touch screen driven (point-of-sale). When a button that causes a screen change is pressed, it needs to happen quickly. From what I understand of Avalonia, SkiaSharp is the default backend and provides rendering performance faster than WPF.

I found the nice write-up for WPF developers and I was excited to see the marked similarity with WPF, yet even more excited that your team has brought in features common to CSS/HTML. From what I see at first glance, there does not seem to be any huge missing features that would prevent me from migrating. At the same time, I try to check my excitement, because each time I tried to migrate to UWP then WinUI, there were a lot of undocumented obstacles that I didn't hit until I had already invested valuable time.

Since I consider cross-platform features a nice bonus, my primary concerns focus on Windows Desktop applications. I apologize in advance for asking anything that's in the documentation.

Aside from the for WPF developers Documentation

  • Has your team needed to push back any features a veteran WPF / NetCore architect would need to be aware of? If so, when will they be?
  • Are there any WPF features that will unlikely be implemented?
  • Have you provided the ability for desktop applications to run full-trust?
  • Have you provided the ability to manipulate Window instances using the hwnd and PInvoke calls?
  • When will it be possible to target Net5.0? I currently target .Net5 pre-7 but can roll back if I must
  • For any WPF developer reading this, what are your impressions and tips for what I should expect?
  • Do you support the latest C Language Sharp Version? Preview versions?
  • Do your project files support the same features as Microsoft's SDK Style? Such as .targets and .props?

I am impressed with how this framework has moved along. If for some reason it doesn't workout for me at this time, I will check back often.

@jmacato
Copy link
Member

jmacato commented Aug 23, 2020

@jtbrower Hey Jason! Thanks for checking us by! I'll try to answer some of your questions, other Q's can be answered with my colleagues later when they're up...

Have you provided the ability to manipulate Window instances using the hwnd and PInvoke calls?

yes, we have an API called IPlatformImpl.Handle and you should be able to convert that to HWNDs/IntPtrs by casting.

When will it be possible to target Net5.0? I currently target .Net5 pre-7 but can roll back if I must

It's ready for the next version since we are on .NET Standard 2.1.

For any WPF developer reading this, what are your impressions and tips for what I should expect?

It's the best thing since sliced bread! Just kidding :) Personally, I've been a WPF dev for 5 years and moving to Avalonia is probably the best way of making cross platform apps, for a former WPF dev that is :)

Do you support the latest C Language Sharp Version? Preview versions?

Yes.

Do your project files support the same features as Microsoft's SDK Style? Such as .targets and .props?

Yes.

@danwalmsley
Copy link
Member

@jtbrower I couldn't find an email address for you and I'd like to reach out to you to talk about the points you raised here. Iv also had very similar experiences to yourself with UWP etc. Perhaps you could contact me [email protected] ?

@jtbrower
Copy link
Author

@jmacato thank you for the great information. Also, good job at interpreting the typos when I asked "Do you support the latest C Language Sharp Version?". I read that today and was confused by my own comment.

@danwalmsley I would love to chat, I will contact you momentarily. For you or anyone else interested, my email is [email protected] .

@martin-braun
Copy link

@danwalmsley @jtbrower I was excited to read on to learn how easy it is to move from WPF to Avalonia, but you sorted things out in a private chat which is sad for anyone curious coming to this issue to learn more about Avalonia.

@jtbrower
Copy link
Author

@danwalmsley @jtbrower I was excited to read on to learn how easy it is to move from WPF to Avalonia, but you sorted things out in a private chat which is sad for anyone curious coming to this issue to learn more about Avalonia.

We didn't discuss anything that would have benefited the conversation being public.

@martin-braun
Copy link

@jtbrower Sorry for assuming it, it kinda looked that way.

@jtbrower
Copy link
Author

@jtbrower Sorry for assuming it, it kinda looked that way.

Understood! Not a problem at all.

I can tell you that I migrated a rather complex portion of my user interface code from WPF to both WinUI and Avalonia and the Avalonia migration went flawlessly while I wasn't able to finish the WinUI version because they lacked the needed features at the time and they might still have the issue now.

I have been away from it for a while due to a few surgeries and backed up priorities that are delaying my return to Avalonia.

I chose Avalonia back in 2020 because the WinUI team missed another important deadline and MAUI didn't look any better.

Now knowing where WinUI and MAUI are at today, it's clear I made the right choice.

Who knows where they will be by the time I can get back on this!

For WPF experts, Avalonia is the easier transition out of all the Xaml Dialects out there in my opinion.

Yes, there is a little bit of a learning curve via lots of Google searches and viewing their source, but it's for change differences that are for the benefit of us all.

If your familiar with WPF, I think you will really like it. I was impressed enough to start donating to their project (using my company) and I haven't done that before.

I did so because all of the people working on this project are thoughtful, motivated and have done an absolutely amazing job.

Just browse through their source code, it's clean coding at its finest.

@martin-braun
Copy link

@jtbrower Thank you for taking your time giving some insights of your experience moving to Avalonia. It's really helpful to me. 🙏🏻

These are good news, I wonder how Avalonia will evolve, especially with competition like uno. My current project will run on Windows, but I see myself making use of Avalonia/uno in the future.

@jtbrower
Copy link
Author

The thing with Uno, as far as I understand, they are tied to WinUI so when WinUI slips schedule, that certainly must impact them. Someone can correct me please, if I am wrong.

I sought out Avalonia not just for cross-platform reasons, but for a more performant version of WPFs rendering. I'm not sure if there are any Whittaker's on this, but it would be good to have.

@danwalmsley
Copy link
Member

There is simply no competition with Uno, if you need a real business get stuff done Desktop first app, nothing competes with Avalonia.

not necessarily business app but desktop focused...
https://icons8.com/lunacy (built on avalonia)

for example.

@martin-braun
Copy link

@danwalmsley I have no doubt about that, but I have to say that #1387 is relevant to me in that regards. If Avalonia approaches WebAssembly I have no reason to even consider uno.

Thank you for your awesome work by the way.

@danwalmsley
Copy link
Member

WebAssembly is coming, we have been waiting for .net 6 to implement this correctly, without that you wont get the performance end users expect.

@schandra09net

This comment was marked as duplicate.

@timunie
Copy link
Contributor

timunie commented Mar 24, 2023

comment above is a duplicate of #10777

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants