What does MvvmCross do that Xamarin doesn't already? - xamarin

Hi so I'm a newb at cross platform stuff and I'm trying to figure out what MvvmCross brings to the table.
From my poor understanding, Xamarin already allows for everything except UI stuff to be written in csharp. Where does MvvmCross come in?

MvvmCross brings the MVVM pattern to platforms where it was previously unavailable, like iOS and Android.
It also supports data binding in Views. This is a powerful feature that provides great separation of concerns. The View will use the ViewModels to offer proper behaviors in the application. MvvmCross even locates the ViewModels in a dedicated project so you can easily reference and reuse them in others.
This is the most important point when talking about MvvmCross. By locating the ViewModels in a Portable Class Library (PCL), you can add them as a reference to any other projects. Of course, that’s not the only interesting point of MvvmCross. There’s also a plug-in architecture, dependency injection (DI) and more.
Source: https://msdn.microsoft.com/en-us/magazine/dn759442.aspx

Xamarin already allows for everything except UI stuff to be written in
csharp.
Xamarin allows you to write UI stuff in C#.
MVVMCross (Mvx) allows you to use the MVVM pattern in cross platform development, so that you can have a shared business logic layer, ViewModel. So you are creating different Views based on the platform but binding to the same ViewModel.

Related

Xamarin Forms Customer Control Library

I need to create a reusable Xamarin Forms control that will be used in two separate projects. It does require custom renderers for IOS and Android. The problem is I cannot figure our what kind of project to use to create a reusable custom control library for Xamarin forms.
Every site seems to talk about creating customer controls that can be reusing in the same project. But I need it in a separate project for reuse.
Can someone please point me in the right direction.
Depending what are your needs regarding multi-targeting, using a solution with a shared project of type MSBuild.Sdk.Extras could be very helpful. You can then packed your shared project into a package that you can reference from your apps project and use locally.
Examples that might guide you and shows you the path are known nuget packages that are being used by app developers cross-platforms, just an example Xamarin.Forms.PancakeView.
Related to MSBuild.Sdk.Extras: How to use different base class in custom control depending on platform target?

Consuming a web service with Xamarin forms

I am learning Xamarin Forms, and I have a few questions.
What's the Portable project that appears in demos and tutorials? My project from scratch is not called Portable.
Must I make my own service interface? After I add the Web reference, References.cs has generated classes and methods. Why not just use those methods directly?
When creating the app, make sure you select Xamarin.Forms, as well as Portable Class Library.
The Portable project (aka Portable Class Library, or PCL) is where the shared code goes for your Xamarin.Forms app. For example, your UI, Models, and View Models will go into that project. You mainly need to worry about the iOS and Android projects for Custom Renderers and Dependency Services, to create custom UI or platform-specific functionality that Xamarin.Forms can't do.
As for consuming the service, its not necessary to create a service interface (I assume its a RESTful service), but it will help you in being able to use the service more easily.

How to use NSOutlineView with ReactiveUI?

I want to convert a small MonoMac application that I created so that it uses the MVVM pattern (especially to port in easily to Windows). I want to use the ReactiveUI framework. The current application uses an NSOutlineView control with a corresponding data source. As far as I could see there is no support currently for this control.
Is there a guideline how to adapt the NSOutlineView and data source so that it supports data binding as used by the ReactiveUI framework?
Unfortunately the data source support that ReactiveUI provides is iOS only and the code is quite complicated, but you can have a look at ReactiveTableViewSource and friends and try to create an equivalent for NSOutlineViewDataSource.
The general idea is, create a NSOutlineViewDataSource that can follow around a ReactiveList of ViewModels, and create Views for them as-needed.

Is there a good MVVM/MVP/MVC framework for JavaFX?

JavaFX with it's binding seems great technology for building UI layer, replacing PHP+AJAX, but are there any frameworks for building database forms applications with JavaFX, or it is meant to write everything from scratch?
You should give a try to some recent libraries :
JRebirth Application Framework to structure your whole application
http://www.jrebirth.org
FXForm to manage form
http://dooapp.github.com/FXForm2/
DataFX to manage complex tables etc..
http://www.javafxdata.org
You can find more tools at http://www.oracle.com/technetwork/java/javafx/community/3rd-party-1844355.html
Eric Bruno has a nice write up on JavaFX and Database using JavaFX Composer. See his articles at DrDobbs

What is the best way to separate UI (designer/editor) logic from the Package framework (like Visual Studio Package)

I want to separate concerns here. Create and embed all the UI logic for the Custom XML designer, object model, validations etc in to a separate assembly. Then the Package framework should only register the designer information and ask for a UI Service and everything works magically.
This way I don't need to play with the Package framework (Visual Studio Package) assembly, when I need to modify the UI designer.
This question also applies to anything where you have to separate the UI logic from the Skeleton framework that loads it up, like a plugin.
I have several choices a ServiceProvider model, a plugin model or may be other.
Any samples, suggestions for patterns, links are welcome.
Update 1: What I am looking for is a thought such as - "Does Prism (Composite WPF) fit the bill? Has anyone worked on a project/application which does the separation of concerns just like I mentioned above? etc"
(I am still looking out for answers)
I've created a VSPackage that loads an editor. The Editor sits in a separate assembly and implements an interface that I defined. The VSPackage works with the interface, so any changes I make to the editor (and its assembly) does not affect the VSPackage as long as I don't change the interface.
What you're asking about seams very much like the separation of concerns that the MVC pattern tries to enforce.
ASP.NET MVC is already out there with a preview 5.
It's mainly for web but I think they are planning on using it also for WinForms, but I'm not sure.
I prefer the Model View Presenter pattern

Resources