using System; using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; using Windows.UI.Xaml.Data; namespace OwlCore.WinUI.Converters.Bools { /// /// A converter that converts a given to its inverse. /// public sealed class InverseBoolConverter : IValueConverter { /// /// Gets the inverse of a bool. /// /// The bool to inverse. /// An inversed bool. [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool Convert(bool data) => !data; /// public object Convert(object value, Type targetType, object parameter, string language) { if (value is bool bValue) { return Convert(bValue); } return false; } /// public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }