RetroFE/Configuration/Configuration/Converter/NullToVisibilityConverter.cs
Vincent-FK 4692a90c48 reinitialize battery ast_id_ in free_graphics
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
2020-11-15 23:27:38 +01:00

26 lines
788 B
C#
Executable File

using System;
using System.Windows;
using System.Windows.Data;
namespace Configuration.Converter
{
public class NullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (targetType != typeof(Visibility))
throw new InvalidOperationException("The target is not of type bool");
return ((object)value != null) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
}