28 lines
770 B
C#
28 lines
770 B
C#
using System;
|
|
using Avalonia.Data.Converters;
|
|
|
|
namespace StreamPlayer.Desktop.Converters;
|
|
|
|
public sealed class InverseBooleanConverter : IValueConverter
|
|
{
|
|
public static readonly InverseBooleanConverter Instance = new();
|
|
|
|
public object? Convert(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if (value is bool boolean)
|
|
{
|
|
return !boolean;
|
|
}
|
|
return Avalonia.AvaloniaProperty.UnsetValue;
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if (value is bool boolean)
|
|
{
|
|
return !boolean;
|
|
}
|
|
return Avalonia.AvaloniaProperty.UnsetValue;
|
|
}
|
|
}
|