Skip to content

Commit 34a58bc

Browse files
committed
Add InverseBoolConverter
1 parent 7ca3769 commit 34a58bc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Windows.Data;
3+
4+
namespace Flow.Launcher.Plugin.Url.Converters;
5+
6+
[ValueConversion(typeof(bool), typeof(bool))]
7+
public class InverseBoolConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
10+
{
11+
if (targetType != typeof(bool))
12+
throw new InvalidOperationException("The target must be a boolean");
13+
14+
return !(bool)value;
15+
}
16+
17+
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
18+
{
19+
throw new NotSupportedException();
20+
}
21+
}

0 commit comments

Comments
 (0)