using System.Globalization;
using Xamarin.Forms;
namespace TINK.View
{
/// Converts a string into visible state. If string is null or empty element becomes invisible.
public class StringNotNullOrEmptyToVisibleConverter : IValueConverter
{
/// Converts a string into visible state.
/// Text value from view model used to derive whether object is visible or not.
/// Boolean value indicating whether object is visible or not.
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null && value is string text && !string.IsNullOrEmpty(text);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return "";
}
}
}