24 lines
787 B
C#
24 lines
787 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace UtopiaCanteenSystem.Converters
|
|
{
|
|
public class StringToVisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
var visible = !string.IsNullOrWhiteSpace(value?.ToString());
|
|
if (string.Equals(parameter?.ToString(), "Invert", StringComparison.OrdinalIgnoreCase))
|
|
visible = !visible;
|
|
return visible ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|