Files
StructureHelper/Infrastructure/UI/Converters/Common/InvertBoolConverter.cs
Evgeny Redikultsev 1cf54603bc Head material was added
2022-10-30 22:20:58 +05:00

34 lines
869 B
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace StructureHelper.Infrastructure.UI.Converters.Common
{
[ValueConversion(typeof(bool), typeof(bool))]
public class InvertBoolConverter : IValueConverter
{
public InvertBoolConverter()
{
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool)
{
return !((bool)value);
}
return true;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Convert(value, targetType, parameter, culture);
}
}
}