Created
June 11, 2020 20:12
-
-
Save ncarandini/80b441fde266215e4f52ed2f6fe6dc99 to your computer and use it in GitHub Desktop.
AllMustBeTrueMultiConverter,cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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