Value converters
In some cases, there are times when we need to data bind two properties of incompatible types. A Converter
is an object that converts the value from source to target and vice versa. Each converter must implement the IValueConverter
interface, which implements two functions, Convert
and ConvetBack
. We are going to create a converter that will take a bool
as the source, and simply return the opposite value to the value in the source.
The ConvertBack
method will only be used if the data binding is a TwoWay
binding.
In the Stocklist.XamForms
project, add a new folder called Converters
, and inside this folder create a new file called NotConverter.cs
, implement the following:
public class NotConverter : IValueConverter { public object ...
Get Xamarin Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.