2021-05-13 20:16:41 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace TINK.View
|
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary> Converts a string into visible state. If string is null or empty element becomes invisible.</summary>
|
|
|
|
|
public class StringNotNullOrEmptyToVisibleConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
/// <summary> Converts a string into visible state.</summary>
|
|
|
|
|
/// <param name="value">Text value from view model used to derive whether object is visible or not.</param>
|
|
|
|
|
/// <returns>Boolean value indicating whether object is visible or not.</returns>
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
return value != null && value is string text && !string.IsNullOrEmpty(text);
|
|
|
|
|
}
|
2021-05-13 20:16:41 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 20:16:41 +02:00
|
|
|
|
}
|