InverseBooleanConverter.cs

28 lines | 512 B Blame History Raw Download
using System;
using System.Globalization;
using System.Windows.Data;

namespace WPF.Common.WPF.Converters
{
	public class InverseBooleanConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if ((bool)value)
			{
				return false;
			}
			return true;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if ((bool)value)
			{
				return false;
			}
			return true;
		}
	}
}