3 ms·
As someone with a good grasp of WPF who intends to rewrite an existing desktop C# WinForms (windows only) application to Avalonia, with the express goal of havi
by josteink 3y ago
As someone with a good grasp of WPF who intends to rewrite an existing desktop C# WinForms (windows only) application to Avalonia, with the express goal of having a single, cross-platform codebase for (at least) Windows and MacOS…
Does anyone have any experiences on doing something similar? Are there any non-obvious pitfalls one risk falling into one should consider upfront?
Any advice appreciated.
- okbloomer 3y agoI am in the process of writing an Avalonia app now and one thing to consider is the controls that you will need. WinForms has a lot available and Avalonia’s coverage isn’t as broad. Hoping it improves over time. Other than that, if you know WPF I think you will enjoy the experience. It has been fun for me so far and I would encourage others to try it out.
- sltr 3y agoWPF and Xamarin dev here who wrote a new (not ported) codebase on Avalonia. - Avalonia has a guide just for people like you and me [1]. - Avalonia's flavor of XAML has small divergences from WPF that will have you hitting their docs often. There are some nice quality-of-life improvements, for example you can bind a Button click handler directly to a method without ICommand. The major concepts are the same e.g. data binding, dependency properties. - Coming from WPF, it's possible you've used MVVM and dependency injection. You'd be going against a strong cultural grain to not use them in Avalonia. But I would be surprised if your WinForms app is architected like that, so it may be a design challenge extracting coherent ViewModels and properties from the ball of mud that many WinForms apps become. - For macOS, read up on notarization [2] and, if you're publishing to the Mac App Store, the review process. - I recommend starting with example apps (look in the Showcase) or with the Avalonia template solution which just runs out of the box. - The Avalonia team iterates quickly. Expect to upgrade NuGets frequently, and don't get too far behind. There was recently a big jump from version 10 to 11. Good for you for starting after that. - Not Avalonia specifically but if you're not used to .NET Core check out #nullable enable. Can't live without it now, but was confusing at first. - Be sure to check out all of the official and community libraries [3]. I bet my design big on `ReactiveUI` and it's gone well. [1] https://docs.avaloniaui.net/docs/get-started/wpf/ https://docs.avaloniaui.net/docs/get-started/wpf/ [2] https://docs.avaloniaui.net/docs/deployment/macOS https://docs.avaloniaui.net/docs/deployment/macOS [3] https://github.com/AvaloniaCommunity/awesome-avalonia https://github.com/AvaloniaCommunity/awesome-avalonia