更新
This commit is contained in:
31
WPFDark/Controls/Converters/BoolInverseConverter.cs
Normal file
31
WPFDark/Controls/Converters/BoolInverseConverter.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace WPFDark.Controls.Converters
|
||||
{
|
||||
public class BoolInverseConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is null)
|
||||
return Binding.DoNothing;
|
||||
|
||||
if (value is bool b)
|
||||
return b == false;
|
||||
|
||||
return Binding.DoNothing;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is null)
|
||||
return Binding.DoNothing;
|
||||
|
||||
if (value is bool b)
|
||||
return b == false;
|
||||
|
||||
return Binding.DoNothing;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user