Skip to content

Instantly share code, notes, and snippets.

@ncarandini
Created June 11, 2020 20:12
Show Gist options
  • Save ncarandini/80b441fde266215e4f52ed2f6fe6dc99 to your computer and use it in GitHub Desktop.
Save ncarandini/80b441fde266215e4f52ed2f6fe6dc99 to your computer and use it in GitHub Desktop.
AllMustBeTrueMultiConverter,cs
using System;
using System.Globalization;
using Xamarin.Forms;
namespace App2
{
class AllMustBeTrueMultiConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
bool result = true;
foreach (object value in values)
{
if (value is bool)
{
result = result && (bool)value;
}
else
{
result = false; // otherwise throw exception if you prefer to.
break;
}
}
return result;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment