A quick forward: there is nothing in this post that isn’t already published here: https://github.com/MvvmCross/MvvmCross/wiki/Value-Converters#the-mvx-visibility-valueconverters.
In this post I referred to a BooleanToVisibilityConverter Windows Store implementation for MVVM Cross. The approach that I outlined in the post will definitely work; however, it will mean re-writing the converter for each platform. So, this post corrects that error.
It was then pointed out to me by a work colleague that there is a Visibility plug-in for MVVM Cross. I wasn’t aware of this, but now that I am, here’s how it works.
Add a reference from NuGet in the front end:
Once you’ve added that, here is the revised and simplified code for the converter:
using Cirrious.CrossCore.WindowsStore.Converters;
using Cirrious.MvvmCross.Plugins.Visibility;
namespace MyGame.Converters
{
public class BooleanToVisibilityConverter : MvxNativeValueConverter { }
}
You will need a wrapper like this for each platform, but at least you’re not re-writing the visibility converter again and again.