21 lines
650 B
C#
21 lines
650 B
C#
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace GifResizer.Views.Converter;
|
|
|
|
public class VisibleWhenNullConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
bool invert = parameter?.ToString() == "invert";
|
|
bool isVisible = invert ? value != null : value == null;
|
|
|
|
return isVisible ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
} |