Search code examples
xamarinxamarin.formsxamarin-studio

How to convert C# - Xaml - Visual Studio Project to Xamarin project


I have complete XAML Project. I want to convert it to xamarin project. So that i can get cross platform support for my project. Is there any way or should i code from scratch in xamarin?


Solution

  • If you have been using WPF i would recommend you start over. While naming is quite similar it differs just to much to just copy and paste it. Also controls that are named the same will behave differently.

    Also the look and feel is rather different than how you would implement it on a desktop, so think of this as a good opportunity to rethink that.

    Depending on how you have structured the underlying code you might be able to reuse (large) portions of your business logic and even your view models, so in that case you would just build another view for your application, which is one of the advantages of using a MVVM pattern, like you say you do.

    Have a look at this link which describes some differences between WPF and Xamarin.Forms XAML.

    A quote right from the introduction:

    As a WPF developer this is great news. I can transfer all my skills across to Xamarin Forms and write cross-platform natively backed UI’s. However, it’s not a direct transfer. There are differences, in much the same way that there were differences between Silverlight and WPF. But these go much deeper.

    Although some of the statements that are made in this blogpost don't fly anymore. Since then Xamarin.Forms has come a long way.

    In this blogpost you can see some hands-on differences with the XAML and how they behave differently.