Add InverseBoolConverter

This commit is contained in:
Jack251970 2025-09-05 18:39:31 +08:00
parent 7ca37697d4
commit 34a58bc5da

View file

@ -0,0 +1,21 @@
using System;
using System.Windows.Data;
namespace Flow.Launcher.Plugin.Url.Converters;
[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (targetType != typeof(bool))
throw new InvalidOperationException("The target must be a boolean");
return !(bool)value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}