Asked by:
How to implement MVC Architecture in Xamarin Studio for developing Cross Platform Application?

Question
-
User132237 posted
Hi, i am beginner in Xamarin Studio and want to know how we can implement MVC architecture in Xamarin Studio for developing Cross Platform Applications using c#?
Tuesday, June 23, 2015 5:34 AM
All replies
-
User31231 posted
Hi @deepti,
I suggest you start with this documentation first: Building Cross-Platform Applications
It has quite a few sections and goes into great detail.
Thanks,
Kevin
Tuesday, June 23, 2015 2:34 PM -
User132237 posted
@KMullins : Thank you so much :)
Wednesday, June 24, 2015 5:05 AM -
User81746 posted
@KMullins is there any MVC Framework exists for xamarin.forms code first approach? thanks in advance!
Wednesday, July 29, 2015 6:55 AM -
User38938 posted
The MVVM pattern is much more suitable for Xamarin.Forms, and Chapter 18 of Creating Mobile Apps with Xamarin.Forms is dedicated to MVVM: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/creating-mobile-apps-xamarin-forms/
Wednesday, July 29, 2015 2:19 PM -
User853 posted
I'm a big fan of the MVC architecture and personally think it's entirely appropriate for cross-platform development. Do you have specific questions?
On iOS, a fairly classical MVC architecture is facilitated by the SDK:
UIViewController
s and their descendants are Controllers andUIView
s and their descendants are viewsOn the Android side, the mappings a little harder, because of
Intent
s, which aren't as coarse as traditional Controllers. (To me, the fascinating thing is that the Android native architecture is one I'd only ever seen before in server clusters. The nice thing about that architecture is that you can scale it so that responsibilities are handed off to other processors and even if they fail you can be resistant to crashes, etc. But I digress...)In Xam.Forms, a
Page
is the Controller, whileView
s are, well, you know. With Forms, we have an MVVM architecture, but you can still make the choice to have the more classic MVC data-flow where the View reflects the Model directly (via binding, with MVVM) rather than the (IMO) often-problematic MVP data-flow in which the Controller/Presenter is in the middle.Wednesday, July 29, 2015 5:35 PM -
User137202 posted
@LarryOBrien said: I'm a big fan of the MVC architecture and personally think it's entirely appropriate for cross-platform development. Do you have specific questions?
On iOS, a fairly classical MVC architecture is facilitated by the SDK:
UIViewController
s and their descendants are Controllers andUIView
s and their descendants are viewsOn the Android side, the mappings a little harder, because of
Intent
s, which aren't as coarse as traditional Controllers. (To me, the fascinating thing is that the Android native architecture is one I'd only ever seen before in server clusters. The nice thing about that architecture is that you can scale it so that responsibilities are handed off to other processors and even if they fail you can be resistant to crashes, etc. But I digress...)In Xam.Forms, a
Page
is the Controller, whileView
s are, well, you know. With Forms, we have an MVVM architecture, but you can still make the choice to have the more classic MVC data-flow where the View reflects the Model directly (via binding, with MVVM) rather than the (IMO) often-problematic MVP data-flow in which the Controller/Presenter is in the middle.Could you point me to an example using MVC architecture with Xamarin.Android?
Sunday, November 22, 2015 5:18 PM -
User1814 posted
Could you guys please port some subset of MVC 5 for mobile? It seems it would make converting web apps to mobile much simpler, not to mention simplify form-based apps in general. I have a huge MVC 5 ASP.Net web app, and I want to port a chunk of it (maybe 20% - sans editing ability) to an offline phone app, but I don't have any phone development experience. I was glad to find you have a razor implementation, but it seems to be without many of the features I need, such as layouts, RenderPartial, etc., which would almost allow me to start from my existing .cshtml sources. I'm curious as to why this wasn't done, as it seems a no-brainer. (Too big and complicated maybe? I'm looking at the sources--pretty hairy.) Otherwise, if there is something out there like this, could someone point me to it? Otherwise I'll have to hack up something myself.
Wednesday, June 1, 2016 9:01 PM -
User1814 posted
I finally found the PortableRazor library and sample, which is a great start. However, it's missing some features I consider essential, such as layouts and RenderPartial.
Thursday, June 2, 2016 10:26 PM