Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What are the key differences between using MvvmCross with Xamarin.Forms and Xamarin native


What are the key differences between using MvvmCross with Xamarin.Forms and Xamarin native


When comparing the use of MvvmCross with Xamarin.Forms and Xamarin native, several key differences emerge, primarily in terms of UI flexibility, code sharing, and development approach.

UI Flexibility and Control

- Xamarin.Forms: This framework provides a shared UI layer across platforms, which simplifies development by allowing you to write UI code once and deploy it on multiple platforms. However, this shared UI can limit customization to platform-specific features, requiring custom renderers for more advanced UI elements[7][9]. MvvmCross can be used with Xamarin.Forms to manage the business logic and navigation, but the UI remains standardized across platforms[1][10].

- Xamarin Native: When using Xamarin native with MvvmCross, you have complete control over the UI for each platform. This allows for platform-specific UI implementations, maximizing the native look and feel of each platform. While this approach requires more effort to develop separate UI layers for iOS and Android, it offers greater flexibility and customization[7][9].

Code Sharing and Reuse

- Xamarin.Forms: With Xamarin.Forms, you can share not only the business logic (via MvvmCross) but also the UI code across platforms. This simplifies development and reduces the amount of code you need to maintain. However, the UI is limited to a common set of elements that work across all platforms[4][10].

- Xamarin Native: In a native Xamarin setup with MvvmCross, you can share the business logic (ViewModels) across platforms, but you must implement the UI separately for each platform. This approach allows for more code reuse in the presentation layer and UI logic when using MvvmCross, but still requires platform-specific UI development[9].

Development Approach

- Xamarin.Forms: Developing with Xamarin.Forms and MvvmCross is often preferred by developers without extensive mobile experience, as it simplifies cross-platform UI development. The framework handles much of the underlying complexity, allowing developers to focus on shared logic and UI[4][10].

- Xamarin Native: Native Xamarin development with MvvmCross is typically favored by developers who want fine-grained control over the UI and are comfortable with platform-specific development. This approach requires more expertise in native iOS and Android development but offers greater flexibility in UI design and implementation[7][9].

Navigation and Binding

- Xamarin.Forms with MvvmCross: Navigation in Xamarin.Forms with MvvmCross is managed at the ViewModel level, allowing for a clean separation of concerns. MvvmCross provides enhanced binding capabilities, such as fallback values, though it lacks some features like the Source property found in standard Xamarin.Forms bindings[2][10].

- Xamarin Native with MvvmCross: In native Xamarin projects, MvvmCross handles navigation and view/viewmodel pairing, allowing for a consistent MVVM architecture across platforms. This setup enables developers to leverage platform-specific navigation patterns while maintaining a shared business logic layer[3][9].

In summary, while both approaches can leverage MvvmCross for MVVM architecture, Xamarin.Forms offers a shared UI layer with less control over platform-specific UI features, whereas Xamarin native provides full control over UI customization but requires more development effort for separate UI implementations.

Citations:
[1] https://www.mvvmcross.com/documentation/platform/xamarin.forms/xamarin-forms
[2] https://www.xamarinhelp.com/use-xamarin-forms-mvvm-framework/
[3] https://canbilgin.wordpress.com/tag/mvvmcross/
[4] https://www.mvvmcross.com/documentation/getting-started/getting-started
[5] https://www.reddit.com/r/androiddev/comments/6cseds/what_are_the_disadvantages_of_xamarin_for_android/
[6] https://canbilgin.wordpress.com/2017/03/26/xamarin-forms-application-with-mvvmcross/
[7] https://stackoverflow.com/questions/38450264/xamarin-forms-vs-xamarin-mvvmcross
[8] https://mentormate.com/blog/6-reasons-mvvmcross-speeds-xamarin-development-personalizes-ux/
[9] https://www.suneco.nl/blogs/boost-your-xamarin-native-projects-with-mvvmcross/
[10] https://visualstudiomagazine.com/articles/2018/05/08/build-a-xamarin.forms-application.aspx