0
votes

I have just started learning Xamarin.Forms.

I created a Xamarin.Forms portable class library and developed the UI which is working on all three mobile platforms (iOS, Android, Windows phone app).

But I want to know, is there any way that I can use that same UI code in an ASP.Net application? How would I do this?

I tried referencing a portable library but it didn't work.

1
i referred this tutorial for Xamarin.Forms ( youtube.com/watch?v=_xfMYdWAo0k ) - Beginner
What .net version your asp.net project targets and what subset does PCL library cover? What didn't worked exactly? - Miha Markic
You can add PCL from Forms application without problems. However, you won't get views rendered in ASP.NET or Views in general for that matter. But you can reuse the ViewModel, Models and other Forms agnostic functionality, just not Views. - Miha Markic
@MihaMarkic Thanks. 1) Yes Right, i have referenced PCL to ASP.Net but it is not rendering the UI so nothing is visible on browser when i run the application. 2) I understand that i can reuse Model,But not understand how to reuse ViewModel. - Beginner
That depends on how your viewmodels are built. It is just code at the end of the day. - Miha Markic

1 Answers

2
votes

No. The XAML used by Xamarin Forms is only (currently) supported in iOS, Android and Windows Phone.