Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transferring an WPF Application to Mobile c# [closed]

I'm just wondering the easiest way to transfer my application into a mobile friendly version that I would be able to put onto android phones. Any help and pointers would be appreciated.

like image 956
John Douglas Avatar asked Apr 11 '16 21:04

John Douglas


People also ask

Can WPF run on mobile?

. NET 5 is s unified platform to write code once and run anywhere.

Is WPF still relevant 2022?

“WPF would be dead in 2022 because Microsoft doesn't need to be promoting non-mobile and non-cloud technology. But WPF might be alive in that sense if it's the best solution for fulfilling specific customer needs today. Therefore, having a hefty desktop application needs to run on Windows 7 PCs with IE 8.

Can you make a mobile app with C#?

You can build apps for Android, iOS, and Windows devices by using Visual Studio. As you design your app, use tools in Visual Studio to easily add connected services such as Microsoft 365, Azure App Service, and Application Insights. Build your apps by using C# and the . NET Framework, HTML and JavaScript, or C++.


1 Answers

Xamarin - it's the best way. Keeps your code in C# with loads of code re-use.

Assuming you developed your WPF app using the MVVM design pattern then porting it to Android might not be that hard. You just need to ensure all your non-UI code is portable (as in it uses the subset of the .Net framework that is available to a portable class library) and move anything device specific to an Android library. If you have been using dependency injection/IoC then this should be relatively simple.

The other option with Xamarin is Xamarin.Forms. Like WPF you define your UI in Xaml and there are controls available from the big control vendors like DevExpress. The output of Xamarin.Forms is a cross platform app so will run on Android, iOS and UWP depending on what platform specific features you need to use - and there are plenty of plug-ins to help with all this.

Once you have the core business logic (the VM and M of MVVM) in a portable class library then you just need to write the UI layer on Android, and from there it's not too hard to add a, iOS or UWP UI layer as well.

Also if you are using MVVM how have you implemented it? If you are using PRISM, MVVMCross or MVVMLight then these support Xamarin apps.

A good blog post showing how to do something similar is on the Xamarin Blog here: https://devblogs.microsoft.com/xamarin/porting-existing-net-apps-to-android/

like image 72
JimBobBennett Avatar answered Oct 20 '22 18:10

JimBobBennett