// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The inverse boolean converter. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Converters { using System; using System.Globalization; using System.Windows.Data; /// /// The inverse boolean converter. /// [ValueConversion(typeof(bool), typeof(bool))] public class InverseBooleanConverter : IValueConverter { #region Implemented Interfaces #region IValueConverter /// /// The convert. /// /// /// The value. /// /// /// The target type. /// /// /// The parameter. /// /// /// The culture. /// /// /// The . /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(bool)) { throw new InvalidOperationException("The target must be a boolean"); } return !(bool)value; } /// /// The convert back. /// /// /// The value. /// /// /// The target type. /// /// /// The parameter. /// /// /// The culture. /// /// /// The . /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } #endregion #endregion } }