Creating User Interface Objects in Xamarin.iOS - Xamarin | Microsoft ...
Creating User Interface Objects in Xamarin.iOS - Xamarin | Microsoft ... | xamarin forms ui designer

Is Xamarin Forms Ui Designer Still Relevant? | Xamarin Forms Ui Designer

Posted on

A absolute adventure and complete adviser to implementing MvvmCross with Xamarin.Forms!

Creating User Interface Objects in Xamarin.iOS - Xamarin | Microsoft ..
Creating User Interface Objects in Xamarin.iOS – Xamarin | Microsoft .. | xamarin forms ui designer
Grial UI Kit for Xamarin Forms - YouTube - xamarin forms ui designer
Grial UI Kit for Xamarin Forms – YouTube – xamarin forms ui designer | xamarin forms ui designer
Ui Designer: Xamarin Ios Ui Designer - xamarin forms ui designer
Ui Designer: Xamarin Ios Ui Designer – xamarin forms ui designer | xamarin forms ui designer
Need some information / hints / help for a special UI-Design w ..
Need some information / hints / help for a special UI-Design w .. | xamarin forms ui designer
Xamarin Forms Cinemax UI Design[Tutorial 10] - YouTube - xamarin forms ui designer
Xamarin Forms Cinemax UI Design[Tutorial 10] – YouTube – xamarin forms ui designer | xamarin forms ui designer

When you alpha to address apps, you apparently sit bottomward and anticipate about how you will anatomy your code, which frameworks you are activity to use, and how you can administer the accomplished project. There are some variables to booty into annual like, will you assignment calm with a team, is a artist involved, or do accession associates accept altered roles? What you don’t appetite is to accept to delay for addition being to accomplishment article afore you can abide your work.

The band-aid for this is to abstracted concerns! Accomplish abiding addition can assignment on the front-end cipher while addition being is alive on on the code-behind. There are a few apropos we can analyze aback architectonics apps:

In adverse to added patterns like MVC(Model, View, Controller) or MVP(Model, View, Presenter), Mvvm abstracts a view’s accompaniment and behavior, acceptation the ViewModel is amenable for advertisement and converting the abstracts from the Model in such a way that altar are calmly managed and presented to the View.

MvvmCross is an adamant booty on MVVM. It follows the aforementioned pattern, and adds a brace of chic extras. It is a framework accurately developed for Xamarin and the adaptable ecosystem. With this in apperception there are a brace of actual accessible appearance that you can advantage to body apps alike faster and of college quality.

Xamarin.Forms let you body congenital UIs for iOS, Android and Windows from a single, aggregate codebase. This agency that apps can allotment a ample allocation of their graphical user interface and still absorb the congenital attending and feel of the ambition platform. This is abundant for apps that crave little platform-specific functionality, area cipher administration is added important than custom UI, or aback developers are adequate with XAML (coming from a WPF or WindowsPhone background). Note that it isn’t appropriate to use XAML for the UI, you can additionally accomplish the layouts in apparent C#.

When we booty a attending at the basal architectonics patterns of Forms, we see some of the aforementioned concepts of MvvmCross. Forms accouterments Mvvm as well, and offers congenital abutment for Annex injection, assorted Aeronautics patterns, Data-binding and messaging amid about accompanying components.

Xamarin.Forms is, aboriginal and foremost, an abstracting of the UI. While it offers some basal functionality to get you going, added Mvvm frameworks admonition you to anatomy and optimize your cipher in an alike bigger way. We will booty a abysmal dive into those advantages after in this blog!

The best important affair to anticipate about aback allotment whether to use Xamarin.Forms, MvvmCross, or any added framework, is what the goals of your app are.

When you accept a bright eyes of these objectives, it ability alike be bigger architectonics a Congenital Xamarin app after application Xamarin.Forms at all!

In any case, the capital annual is that you alpha off with a abstracted “MVVM” activity for your aggregate code, and you can (re)use it if you anytime adjudge to about-face to Congenital Xamarin, or addition UI framework.

Lets say we accept a activity altogether adapted to do Xamarin.Forms, you appetite to optimize your development process, accept abundant maintainability of code, and be accessible for the future. A acceptable fit for this would be MvvmCross! The capital allowances you instantly get aback application MvvmCross are:

MvvmCross itself offers abutment for a advanced ambit of platforms, and as for Xamarin.Forms abutment we have:

In the approaching we will add abutment for added platforms, as Forms platforms get adapted to stable. This will accommodate MacOS, Tizen, WPF, Linux (GTK#) and more!

MvvmCross has some actual accessible Nuget bales to get you started. In this case we will use the StarterPack Nuget to install the basal files and the MvvmCross.Forms Nuget to get us affiliated to Forms. Addition abundant way is to use a Visual Studio addendum like XabluCross for MvvmCross. In this adviser I’m activity to use Visual Studio for Mac to advance the sample App. You should be able to do the aforementioned application Visual Studio 2017, but things ability aloof attending hardly different.


We do this because contrarily the Forms.App chic conflicts with the MvvmCross.App class.




public override bool FinishedLaunching(UIApplication app, NSDictionary options){Window = new UIWindow(UIScreen.MainScreen.Bounds);

var bureaucracy = new Setup(this, Window);setup.Initialize();

var startup = Mvx.Resolve<IMvxAppStart>();startup.Start();



return true;}}



Otherwise your Forms Activity wouldn’t run and you’ll ashore on the splashScreen.

The aftereffect of this tutorial is accessible at:

By absence this is done application allotment conventions. If your Appearance is alleged LoginView again the ViewModel it will attending for should be alleged LoginViewModel. Addition way is application Generics to announce the ViewModel to use. I would acclaim this aback it is blazon safe.

The XAML blueprint for this folio would again attending like:

To use the congenital MvvmCross bindings aural a Xamarin.Forms folio artlessly add a advertence to MvvmCross.Forms.Bindings like this: xmlns:mvx=”clr-namespace:MvvmCross.Forms.Bindings;assembly=MvvmCross.Forms” in the XAML page.

After you’ve added the advertence you will be able to bind to any accurate ascendancy application mvx:Bi.nd=””. This could for archetype attending like:

Using the MvvmCross bindings doesn’t exclude application Xamarin.Forms bindings, but there are some bright advantages aback you use ‘mvx’ bindings.

More admonition about this is accessible in the documentation.

MvvmCross uses ViewModel Aboriginal Navigation. This agency that we cross from ViewModel to ViewModel and not from Appearance to View. It ships with its own aeronautics arrangement alleged IMvxNavigationService to cross amid these ViewModels. This enables you to canyon an article to a new ViewModel and anticipate a aftereffect aback you aing a ViewModel that is on top of addition one. This would attending like:

public async Assignment SomeMethod(){var aftereffect = anticipate _navigationService.Navigate<NextViewModel, MyObject, MyReturnObject>(new MyObject());//Do article with the aftereffect MyReturnObject that you get back}}

public chic NextViewModel : MvxViewModel<MyObject, MyReturnObject>{public async Assignment Initialize(MyObject parameter){//Do article with parameter}

public async Assignment SomeMethod(){await Close(new MyReturnObject());}}

For all-encompassing affidavit about this attending at the Aeronautics documentation.

The NavigationService supports assorted URIs per ViewModel as able-bodied as “NavigationFacades” that acknowledgment the appropriate ViewModel ambit depending on the URI.

To use URI aeronautics accumulation your routings as accumulation attributes. I would acclaim putting them in the aforementioned book as the referenced ViewModel.

Depending on the cachet of the app you can canyon a URI as the Notification Parameter, so aback the app starts you can abysmal articulation anon to the appearance you want. From a ViewModel angle this would attending like:

private IMvxAsyncCommand _showACommand;public IMvxAsyncCommand ShowACommand{get{return _showACommand ?? (_showACommand = new MvxAsyncCommand(async () =>{await _navigationService.Navigate(“mvx://test/?id=” Guid.NewGuid().ToString(“N”));}));}}}

MvvmCross uses Presenters to cross to angle on the congenital platform. It is a article that acts as a cement amid your Angle and your ViewModels. As the name implies, a appearance presenter takes a ViewModel presentation appeal and decides how it will be presented on the UI. By application Appearance Presenters, MvvmCross provides a bright break amid the ViewModel and the Appearance layer

This is additionally the key to what enables us to appearance any Native, Forms appearance or bond it while navigating. As we saw beforehand the IMvxNavigationService lets you canyon altar and acknowledgment altar to any apprehension ViewModel. This is functionality that Forms doesn’t offer.

It is absolutely accessible to change the behaviour of the NavigationService or the Appearance Presenter. Aloof override either of them to apparatus your own version. Application this to your advantage is a actual able apparatus to body aing bearing apps!

There are lots of accessories and introductions accessible on this. Some acceptable starting places are Martin Fowler’s addition and Joel Abrahamsson’s IoC introduction.

Specifically aural MvvmCross, we accommodate a distinct changeless chic Mvx which acts as a distinct abode for both registering and absolute interfaces and their implementations.

As you could see in the aftermost samples we acclimated Annex Bang to inject the IMvxNavigationService into the ViewModel. In actuality this is beneath the awning registered to the MvvmCross IoC container!

Sometimes you charge to use some platform-specific functionality in your ViewModels. For example, you ability appetite to get the accepted awning ambit in your ViewModel , but there’s no absolute PCL .Net alarm to do this. What we can do is acknowledge an interface in the Core project, but again accommodate and annals an accomplishing in anniversary of your UI belvedere projects.

Create an interface in your PCL-Core projectIn your project, you can acknowledge an interface and you can use that interface in any of your classes there:

In anniversary UI project, you can again acknowledge the platform-specific accomplishing for IScreenSize – a atomic archetype is:

You can again annals these implementations in anniversary of the platform-specific Bureaucracy files — e.g. you could override MvxSetup.InitializeFirstChancewith

With this done, the MyViewModel will be provided with the actual belvedere specific accomplishing of IScreenSize on anniversary platform.

This is atomic with the congenital MvxValueConverter. Amount Converters in MvvmCross are acclimated to accommodate mappings to/from analytic ethics in the appearance models and presented ethics in the user interface.

For example, a amount advocate for converting DateTime in the ViewModel to ‘time ago’ cord in the Appearance ability attending like:

if (timeAgo.TotalMinutes < 10){return “a few annual ago”;}

if (timeAgo.TotalMinutes < 60){return “in the aftermost hour”;}

if (timeAgo.TotalMinutes < 24*60){return “in the aftermost day”;}

return “previously”;}}

Binding to for archetype a Label and converting the DateTime is as accessible as:

When a ViewModel is loaded a brace of contest and methods will be triggered. You can use those to assassinate cipher that charge to appear in altered situations. It will accord you added aesthetic ascendancy of the ViewModel and the accompaniment of its lifecycle. There may be bounden that you appetite to amend or assets to apple-pie up, and these lifecycle contest can admonition with that.

In any case the ViewModel will alarm the Assignment Initialize(){} adjustment area you should do all your antecedent loading of data. Try to use async functions and caching to optimize the acceleration of your App.

As approved before, if you canyon an article to a ViewModel the Assignment Initialize(MyObject param){} will be alleged instead.

The contest in MvvmCross acclaim the contest in Forms. We alike took afflatus from the angle that was fabricated for Xamarin.Forms.

Using them is as simple as bottomward in the Nuget amalgamation for it. Searching for MvvmCross Plugin on Nuget allotment all the accessible packages. After that you can advance them by either application annex bang or absolute the interface. Let’s accept a attending at one of the bales alleged Messenger.

The MvvmCross Agent plugin provides an Accident accession Agent which is biased appear application Weak references for accident subscription. You can ascertain one or added Bulletin classes for advice amid components. These should accede from MvxMessage:

public bifold Lat {get;private set;}public bifold Lng {get;private set;}}

Sending this bulletin is simple as:


To accept the bulletin in any ViewModel, subscribe to these blazon of messages. Anniversary of these classes charge alarm one of the Subscribe methods on the IMvxMessenger and charge abundance the alternate token. For archetype allotment of a ViewModel accepting LocationMessages ability attending like:

private abandoned OnLocationMessage(LocationMessage locationMessage){Lat = locationMessage.Lat;Lng = locationMessage.Lng;}}

If you appetite to accessible a Congenital appearance after any MvvmCross or Forms, you charge to apparatus your own presenter if you appetite to do it through MvvmCross. However if you aloof appetite to add a appearance that stands abandoned and handles it own business you could aloof add this to the platforms UI stack.

Right now we don’t accept congenital abutment for Forms Embedding, but this is planned aback 3.0 hits stable. Best of the functionality that would accredit this is already present in the accepted MvvmCross stable, so it would be a baby footfall to add abutment later.

Performance depends on a lot of altered things. Aboriginal of all, while Xamarin.Forms has absolutely acceptable achievement compared to added UI frameworks, it is still an absorption that ability apathetic bottomward things. Taking into annual that we are alive with Forms there are a few tips and tricks I would like to share:

For added tips i would acclaim to apprehend 5 Ways to Boost Xamarin.Forms App Startup Time by David Ortinau!

In my assessment it would apparently be too big of a assignment to drift all your cipher to use Xamarin.Forms. However, aback it is accessible to mix and bout Congenital and Forms code, you can adjudge to body assertive new appearance application Forms. Booty into annual the skillset of the bodies you assignment with, the requirements of the affection and the platforms specific API’s that are needed, and accomplish an accomplished accommodation on what would assignment best in your situation.

If you appetite to apperceive added I acclaim account the MvvmCross affidavit on MvvmCross & Forms. Added advantageous links are:

Next time I’ll appearance and allocution about:

Is Xamarin Forms Ui Designer Still Relevant? | Xamarin Forms Ui Designer – xamarin forms ui designer
| Delightful to my weblog, in this time I will show you with regards to xamarin forms ui designer

Xamarin Forms Advanced LogIn Page UI Design[Tutorial 10] - YouTube - xamarin forms ui designer
Xamarin Forms Advanced LogIn Page UI Design[Tutorial 10] – YouTube – xamarin forms ui designer | xamarin forms ui designer

Gallery for Is Xamarin Forms Ui Designer Still Relevant? | Xamarin Forms Ui Designer