MvvmCross 5.0 release!

Announcing MvvmCross 5.0!

We’re happy to announce the immediate availability of MvvmCross 5.0! For the last 6 months we have been working on this release and we’re really excited about it.

Let’s have a look at the highlights:

Merge of repos

For a long time we have been looking at merging the different repositories of the project. Besides a better overview one of the main advantages this brings is the ability to setup a proper CI process. This is hugely beneficial in the release process itself and makes (patch) releasing MvvmCross a breeze.

New website with improved documentation

Over time we have received a lot of feedback from developers that use MvvmCross on a day-to-day basis. Besides the usual hugs and kisses, the most common remark we often got was: “sir, you need to improve the documentation”. And as you all know: writing documentation is hard. And not always the most fun thing you can think of. So our first focus was enabling you to help out with improving the documentation. With 5.0, the documentation has landed in the GIT repo, making it possible to submit documentation (changes) just as you do with code: create a pull request. We’re already seeing the benefits of this: the amount of community-driven documentation changes has increased tenfold.

Over the coming months we’ll introduce a ‘documentation policy’ to make sure the documentation keeps on improving over time and keeps its uniformity.

For more information and to start contributing to the website see the Documentation style guide

Open Collective

As you all know, MvvmCross is an Open Source project, so that means we’re not making any money out of it. But sometimes we’re facing actual costs, which are always difficult to manage. To improve on this situation we’ve created the MvvmCross Open Collective - a place where you can donate your money to the project but also have full insight into what we’re actually doing with it. We really hope you’ll join this Open Collective!

OpenCollective website

Improved support for Xamarin.Forms

In MvvmCross 5.0 we added much improved support for Xamarin.Forms! We added MvvmCross-specific Pages, App classes, and Setup for Forms to enable Bindings, Ioc, DI and much more! Make sure to use the new base classes to enable Forms support.

Find all the details in the updated documentation!

New iOS presenter

Starting with MvvmCross 5.0, there is a new default Presenter for Views, namely MvxIosViewPresenter.

View Presenter Overview

The default presenter that comes with MvvmCross offers out of the box support for the following navigation patterns/strategies:

  • Stack navigation
  • Tabs
  • SplitView
  • Modal
  • Modal navigation

If your app needs another kind of presentation mode, you can also easily extend it!

Presentation Attributes

The presenter uses a set of PresentationAttributes to define how a view will be displayed. The existing attributes are:

  • MvxRootPresentationAttribute
  • MvxChildPresentationAttribute
  • MvxModalPresentationAttribute
  • MvxTabPresentationAttribute
  • MvxMasterSplitViewPresentationAttribute
  • MvxDetailSplitViewPresentationAttribute

Views without attributes: Default values

  • If the initial view class of your app has no attribute over it, the presenter will assume stack navigation and will wrap your initial view in a MvxNavigationController.
  • If a view class has no attribute over it, the presenter will assume animated child presentation.

Sample please!

You can browse the code of the Playground iOS project to see this presenter in action.

Improved navigation

MvvmCross 5 introduces a new NavigationService! The new navigation enables you to inject it into your ViewModels, which makes it more testable, and gives you the ability to implement your own navigation!

The main features of the new navigation are:

  • Return a result to the ViewModel where you navigated from
  • Check if you are able to navigate to a certain ViewModel
  • Type safe
  • Fully async await
  • URL navigation with deeplinking to ViewModels
  • Events on navigate

The following Api is available to use:

public interface IMvxNavigationService
{
    Task Navigate<TViewModel>() where TViewModel : IMvxViewModel;
    Task Navigate<TViewModel, TParameter>(TParameter param) where TViewModel : IMvxViewModel<TParameter> where TParameter : class;
    Task<TResult> Navigate<TViewModel, TParameter, TResult>(TParameter param) where TViewModel : IMvxViewModel<TParameter, TResult> where TParameter : class where TResult : class;
    Task<TResult> Navigate<TViewModel, TResult>() where TViewModel : IMvxViewModelResult<TResult> where TResult : class;
    Task Navigate(string path);
    Task Navigate<TParameter>(string path, TParameter param) where TParameter : class;
    Task<TResult> Navigate<TResult>(string path) where TResult : class;
    Task<TResult> Navigate<TParameter, TResult>(string path, TParameter param) where TParameter : class where TResult : class;
    Task<bool> CanNavigate(string path);
    Task<bool> CanNavigate<TViewModel>() where TViewModel : IMvxViewModel;
    Task<bool> Close(IMvxViewModel viewModel);
}

For more details see #1634

The Uri navigation will build the navigation stack if required. This will also enable deeplinking and building up the navigationstack for it. Every ViewModel added to the stack can split up into multiple paths of it’s own backstack. This will enable all kinds of layout structures as Hamburger, Tab or Top navigation.

If you want to intercept ViewModel navigation changes you can hook into the events of the NavigationService.

Mvx.Resolve<IMvxNavigationService>().AfterClose += (object sender, NavigateEventArgs e) => {
    //Do something with e.ViewModel
};

The events available are:

  • BeforeNavigate
  • AfterNavigate
  • BeforeClose
  • AfterClose

The new navigation also allows to navigate directly to an instance of a viewmodel instead of to a type.

A full explanation can be found on the documentation

Lifecycle / Event hooks

Starting from MvvmCross 5.0 ViewModels will be coupled to the lifecycle of the view. This means that the ViewModel has the following methods available:

    void Appearing();
    void Appeared();
    void Disappearing();
    void Disappeared();

The MvxViewController, MvxFragment(s), MvxActivity and the UWP views will call those methods open the platform specific events that are fired. This will give us a more refined control of the ViewModel and the state of its lifecycle. There may be binding that you want to update or resources to clean up, these lifecycle events can help with that.

It should be noted however that it is not 100% reliable but it should work for most of the apps. We don’t know what you do in the lifecycle of your app and what could interfere with the called order of the viewmodel lifecycle events.

For more information on the implementation of this functionality please see Github

Documentation for this is available on the website

Generic and typed bindings

This change will add a generic “WithConversion” method. This will allow developers to strongly type the use of value converters, making refactoring a lot easier and more save. For example:

set.Bind(textField).To(vm => vm.Counter).WithConversion<SomeValueConverter>();

Add something about the Generic implementation of IMvxTargetBinding #1610

MvvmCross 5 now supports an additional option besides literal strings for MvvmCross defined custom bindings, via the use of binding extension methods. Binding with extension methods allows for compile time checking whether the binding is possible against the specified control base type, i.e. TouchUpInside binding works against UIControl inheritance and not a UIView.

Developer Usage

var labelButton = new UILabel();

var bindingSet = this.CreateBindingSet<HomeViewController, HomeViewModel>();
bindingSet.Bind(labelButton).For(c => c.BindText()).To(vm => vm.NextLabel);
bindingSet.Bind(labelButton).For(c => c.BindTap()).To(vm => vm.NextCommand);
bindingSet.Apply();

More information can be found in the documentation

Removal of WindowsPhone 8.x and Windows 8.x

As is usual with a major release it’s time to say goodbye to old friends. Windows(Phone) 8 has been deprecated for a long time; removing formal support for this platform is the right thing to do.

Removal of deprecated plugins

MvvmCross’ powerful plugin framework has brought us many good things. However, over time certain plugins have become obsolete, not maintained any longer or considered not useful anymore. With 5.0 we’ve decided to remove the following plugins:

AutoView

No maintained for a long time.

CrossUI

No maintained for a long time.

Dialog

No maintained for a long time.

SQLite plugin

No actual functionality was in this plugin. To use this, simpely include the SQLite-PCL nuget.

Bookmarks

Only in use on Windows (Phone) 8

SoundEffects

Only in use on Windows (Phone) 8

ThreadUtils

Only in use on Windows (Phone) 8

JASidePanels

We had two different implementations of a Sidemenu on iOS in MvvmCross. The default one is now MvvmCross - XamarinSidebar. See the documentation for more details.

Other improvements

Improved starterpack

The default files installed when you add the MvvmCross StarterPack nuget are updated and improved to reflect all changes in 5.0 and offer a more real-life situation base to start with.

tvOS support

tvOS support has been added and improved to enable even better cross-platform development.

Test projects in main repo

We’ve added a couple of test projects in the main repo so we can test and reproduce issues very quickly.

Migrate Test.Core to PCL

The Test packages are now based on PCL instead of NET45 so you can target more platforms.

The now-default XamarinSidebar menu for MvvmCross iOS has been improved with a couple of new features. Read more about this in the documentation.

Roadmap towards MvvmCross 6.0

Before MvvmCross 6.0 we want to release a couple of important fixes and new features. Among those are:

  • Even better Xamarin.Forms support
  • A new default presenter for Android
  • Better handling of Fragments

For MvvmCross 6.0 the plan is to, in the first place support .NET Standard 2.0. At the same time we want to use that to refactor the plugins structure, make more use of async await, and C#7!

For the full overview and discussion on the roadmap for 6.0 see #1415

Changelog

More than 150 PR’s made it in this release from over 40 developers. So a big hug to all these contributors!

5.0.0 (2017-05-22)

Full Changelog

Fixed bugs:

  • MvxTableViewController does not call MvxViewModel.Appearing() et. al #1813

Closed issues:

  • Close a view with no Presentation Attribute that was opened from a Tab #1834
  • MvxViewModel completes its TCS in the wrong sequence #1821
  • MvxTabBarViewController forces all navigation bars to be opaque #1819
  • MvvmCross.Plugins.File MvxFileStore read using full path #1673
  • MvxUIDatePickerDateTargetBinding should not set default date to DateTime.Now if MaximumDate < Now #1618

Merged pull requests:

5.0.0-beta.11 (2017-05-17)

Full Changelog

Fixed bugs:

  • MvxTabBarViewController.VisibleUIViewController throws for tabs without a navigation controller #1812

Merged pull requests:

5.0.0-beta.10 (2017-05-15)

Full Changelog

Merged pull requests:

5.0.0-beta.9 (2017-05-13)

Full Changelog

Closed issues:

  • about .NET Standard Class Library #1787

Merged pull requests:

5.0.0-beta.8 (2017-05-10)

Full Changelog

Closed issues:

  • Feature request: Property binding in iOS designer #1781
  • Make some methods in MvxWindowsMultiRegionViewPresenter protected #1779
  • the mvvmcross.com’s Doc isn’t too good show in mobile phone #1776
  • Realm and MvvmCross activity lifecycle, collection change notifications on destroyed fragments #1770
  • How to “hook into” and do some post processing after a call to BindingInflate? #1769
  • Kill MvxAllThreadDispatchingObject #1750
  • MvxHorizontalGridView is broken #1743
  • Custom MvxRecyclerViewAdapters don’t work anymore #1730
  • Improve MvvmCross.StarterPack #1659
  • Binding to Realm IList issue #1545
  • Network plugin rest client could support aborting the request #569

Merged pull requests:

5.0.0-beta.7 (2017-05-03)

Full Changelog

Merged pull requests:

5.0.0-beta.6 (2017-05-01)

Full Changelog

Merged pull requests:

5.0.0-beta.5 (2017-04-30)

Full Changelog

Fixed bugs:

  • [Android] Setup initialization issue when app killed and resumed #1192
  • MvxAutoCompleteTextView/MvxFilteringAdapter locks when PartialText is the same value #1162
  • MvxPictureChooserTask does not (always) work when it get’s called from a Android Fragment #1107
  • MvxNSDatePickerDateTargetBinding timezone issues #924
  • picturechooser always show in portrait orientation #761
  • Annoyance when using Converter #697
  • Problem with Android.Dialog and text focus #337
  • Sort out mess of IMvxTouchPlatformProperties #315

Closed issues:

  • NullReferenceException in MvxPathSourceStep.ClearPathSourceBinding #1414
  • Bulk Registration by Convention work not correctly #1381
  • ViewModel is null in fragment if the fragment’s MvxFragmentAttribute.IsCacheableFragment is set to false #1371
  • Axml binding performance issue #1342
  • SuspensionManager failed when migrating to UWP #1328
  • UWP ShowViewModel Too Early #1223
  • Initialize MvvmCross in background fetch on iOS #1219
  • ReloadFromBundle not called #1177
  • MvxTabBarViewController.ItemSelected override error #1167
  • [Android] RaiseCanExecuteChanged and UI Thread #1160
  • DefaultImagePath no longer working for MvxImageViewLoader? #1152
  • Update “ViewModel to ViewModel Navigation” article alternatives to pages #1140
  • MvxDatePicker value not updated on lollipop devices #1139
  • Calling Init() on ViewModel creates exception without parameters #1132
  • IMvxLocationWatcher.Stop() do not disable hardware GPS on iOS #1127
  • Could you add XML comments to classes and methods within Cirrious.MvvmCross? #1108
  • IMvxMainThreadDispatcher needs a method where you can wait for the UI task to finish #1033
  • Editing bound EditText with android:textAllCaps causes exeption #1002
  • Reason for multiple initialisation should not be called simultaneously? #955
  • PictureChooser - Save image to gallery #936
  • Unified API: binding target is garbage collected #902
  • MvxTableLayout enhancement #850
  • MvxStringToTypeParser does not parse using InvariantCulture #840
  • CurrentCulture vs CurrentUICulture in bindings #839
  • Be able to pass an Enum value as a CommandParameter for Android(and possibly other platforms too) #767
  • Tutorial for MvxAutoCompleteTextView #702
  • a better MvxPickerViewModel #674
  • File plugin does not support embedded resource files for Android #635
  • Allow custom JSON serialization / deserialization settings in JSON plugin #610
  • AddHeader\AddFooter methods in MvxListView #602
  • BindingText #585
  • Could UIViewController/Activity code behind be used with Action<IMvxListItemView> to set list item bindings #573
  • Rest Client could support XML as well as JSON #570
  • Allow for setter only fluent property binding #567
  • Could plugins be extended to some form of Core-UI project contract too #496
  • “Nice to have” option to override plugin loading #492
  • Reduce ObjectGraph by using HiddenReference for MvxActivity.BindingContext? #409
  • Consider dropping DataBinding update priority #404
  • Add new constructor to MvxGeneralEventSubscription with sourceEventName. #400
  • Investigate better support for GetItemViewType #333
  • Consider allowing nullable services in IoC constructors #239
  • Add Facebook sharing for iOS #188
  • Consider caching parse results #125

Merged pull requests:

5.0.0-beta.4 (2017-04-29)

Full Changelog

Fixed bugs:

  • Can an IMvxVisibleViewModel interface/pattern be added #74

Closed issues:

  • Master Detail Example Project Doesn’t Compile with Latest MvvmCross Nuget Packages #1699
  • Master detail - working xamarin forms example #1681
  • Sample Forms projects on older versions of MvvmCross and Xamarin.Forms #1679
  • Consolidate NuGet packages #1672
  • MvxFileStore FullPath Customization #1630
  • NullReferenceException in MvxTaskBasedBindingContext in Release mode #1508
  • New MvxListView bindings not working since last xamarin update #1395
  • Add build test of UWP project #1392
  • Can a general Close/Back event be added to MvxViewModel? #609
  • MvxGridView: can not set gravity of child items because of proxied FrameLayout #539
  • Unify MvxCollectionViewCell and MvxTableViewCell constructors #367
  • In PhoneCall Plugin, would be nice if phone detected in API #95

Merged pull requests:

5.0.0-beta.3 (2017-04-28)

Full Changelog

Fixed bugs:

  • [5.0.0-beta0001] Some nuget packages are missing dll’s #1725
  • FusedLocationHandler crashing with MvxException: SERVICE_MISSING #1669

Closed issues:

  • Improve load time of plugins #1729
  • Generate PDBs for source linking with GitLink #1314

Merged pull requests:

5.0.0-beta.2 (2017-04-26)

Full Changelog

Closed issues:

  • Add open collective to the website #1723
  • Build broken after merge of #1693 #1720
  • Website: Missing margins between logos #1712

Merged pull requests:

5.0.0-beta.1 (2017-04-25)

Full Changelog

Fixed bugs:

  • Android : Exceptions in MvxValueConverter<TFrom, TTo>.Convert are hidden #1655
  • MvxAsyncCommand inconsistencies on Android #1589
  • Error XA4204: Unable to resolve interface type ‘Android.Gms.Common.Apis.GoogleApiClient/IConnectionCallbacks’. #1558
  • iOS Autocorrect UITextView not captured #1555
  • Cannot/how to set LayoutManager for children RecyclerViews bound with local:MvxItemTemplate - XML local:layoutManager does not work #1512
  • RadioButton’s width doesn’t use match_parent #1451
  • Bindings in 4.2.x System.AggregateException caught in HockeyApp #1398
  • AppCompatActivity and ActionBarActivity cause null reference exception onCreate(Bundle ….) #1112
  • Sometime CrossUI.Touch Elements don’t repaint until rotated #977
  • Sort out SQLite installer for winrt #307
  • [WIP] Issue 1465 - Switch to ViewHolder pattern instead of wrapping in FrameLayout for MvxListView items #1535 (orzech85)

Closed issues:

  • Remove JASidePanels nuspec #1708
  • Binding data with headers does not work #1702
  • Remove Bookmarks plugin #1701
  • Remove SoundEffects #1700
  • Links in docs menu point at mvvmcross-docs repo #1688
  • Remove JASidePanels #1682
  • Registering services in InitializeFirstChance not working as expected #1676
  • Cleanup: Obsolete MvxFormFactorSpecificAttribute #1670
  • MvxAppCompatSpinner’s Adapter’s SimpleViewLayoutId should probably be Android.Resource.Layout.SimpleSpinnerItem #1666
  • RFE: remove plugin ‘ThreadUtils’ for 5.0 #1665
  • RFE: remove plugin ‘ReflectionEx’ for 5.0 #1664
  • Column with name “column” is not defined on the local table “table” #1662
  • TextView Click binding fails in Release #1651
  • MvxRadioGroup binding fails in Release after updating to 4.4.0 #1650
  • InfoWindowClick does not work with ShowViewModel #1647
  • New RecyclerView Grouping crash on Clear/Insert sequence #1640
  • RecyclerView Header/Footer crash on tap when using custom Header/Footer DataContext #1637
  • Remove Windows 8.1/WP8.1 examples #1620
  • Using viewmodel navigation with complex parameter fails silently #1615
  • Add id parameter to MvxTabPresentation #1614
  • Remove ReflectionEx Plugin #1606
  • Improving MvxTargetBindingFactoryRegistry #1594
  • Custom font not working with MvxAppCompatActivity #1592
  • Android Tabs Example #1586
  • How to hide all XamarinSidebar menu on page ? (iOS) #1585
  • Toolbar Search Binding #1584
  • Virtualize MvxExpandableListAdapter methods #1582
  • TestProjects\Forms\Example001XAML\Example001XAML.sln does not compile #1580
  • Telerik 2017 R1 for Xamarin.Forms Android incompatible with MvvmCross #1579
  • Add Preserve attribute to all bindings #1578
  • JASidePanels Slide Menu iOS Native Library Crash only on device #1577
  • Find alternative to readme.io #1575
  • Android projects have specific Compile version set #1573
  • Nuspec PCL profiles? #1572
  • [AndroidSupport] RecyclerView view created by adapter should be accessable in code after view is inflated #1566
  • [AndroidSupport] RecyclerView support for Footer/Header/Grouping (sections) #1565
  • [AndroidSupport] FAB AutoHide behavior - same support for new BottomBar #1563
  • Navigation Page shows foreign language “Zuruck”. How do I fix or override this? #1561
  • Error installing MvvmCross.Forms.Presenter #1560
  • [Proposal] Strongly typed MvvmCross code based binding properties #1557
  • Android send intent from external apps does not start main activity on some devices/OS #1551
  • MvxAndroidViewFactory CreateView question #1550
  • “Partial declarations of ‘TestView’ must not specify different base classes” error #1547
  • Mvx.MvxListView ItemAppearing #1544
  • MvxListView ItemClick doesn’t work #1543
  • iOS crash/ <unknown> <0xffffffff>/ Foundation.NSObject.ReleaseManagedRef /Foundation.NSObject/NSObject_Disposer.Drain #1539
  • Create new event hooks for lifecycle events #1531
  • OnDataContextChanged should only be called when the data context actually changes #1522
  • cant get connection #1513
  • Fix references in sub projects #1506
  • Update Android OnAttach #1503
  • Move back sub repos into main #1500
  • app crashing after detaching from VS debugger #1498
  • Add ItemClick on LinearLayout as on ListView #1496
  • Databinding Not Working as Expected on MVVMCross #1487
  • MvxObservableCollection RemoveRange Exception #1485
  • Binding issue when doing full linking on Android for TextView on latest 4.4.0 #1482
  • StarterPack nuspec dependency doesn’t get updated #1479
  • rendering issue with dynamic sized UILabels using Constraints #1468
  • Switch to ViewHolder pattern instead of wrapping in FrameLayout for MvxListView items #1465
  • MvxDialogViewController does not Dispose after assigning the Root element #1445
  • MvxImageView Issue with nested MvxRecyclerView #1444
  • Binding.Mac does not build on Windows #1437
  • Reloading the Main Activity : Navigation Stops working #1408
  • set_TextFormatted leads to app crash #1405
  • A standardized way of doing vm -> view communication #1386
  • MvvmCross Unity3d ugui #1380
  • NullReferenceException in MvxFullBinding #1378
  • MvvmCross.Tests nuget can’t be added to a PCL project #1375
  • MyGet Nuget feed #1369
  • Support URL based navigation #1315
  • System.InvalidCastException on Android #1305
  • continuous integration and pre-release builds #1301
  • iOS EntryElement binding problem (revised) #1291
  • MvxModalNavSupportIosViewPresenter does not use CurrentTopViewController #1274
  • Sharing code across Apple platforms #1166
  • ValueConverter registration doesn’t work anymore in v4.0 beta 3 #1154
  • Pushing symbols fails for many packages #1032
  • Add ability to request current device location with async API #1024
  • BindinEx wpa8.1 #967
  • OnNavigatedTo Event Throwing Error in Windows 10 Preview #816
  • MvxListItemView not measuring correctly? #774
  • ICommand binding on iOS not working with CanExecute #720
  • Add support for event to command for WP8 binding #640
  • File Plugin for Windows Store needs using Statements around stream #637
  • Can’t pass decimal type in ViewModel Init function #564
  • MvxIoCSupportingTest for WindowsPhone and others? #523
  • Feature Requests: MultiLine TextEdit and Double button element for ios dialog #522
  • Simple WebContentElement for iOS dialog #509
  • CrossUI.Touch.Dialog.Elements.Section does not respect Visibility #407
  • Problems with IElementSizing in Monotouch.Dialog included into MvvmCross #182

Merged pull requests: