using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; namespace Tango.SharedUI.Converters { /// /// Inversed binding converter for standard boolean to visibility and back. /// public class BooleanToVisibilityInverseConverter : IValueConverter { /// /// Converts a boolean value to visibility enumeration. /// /// Boolean value. /// /// /// /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((bool)value) return Visibility.Collapsed; return Visibility.Visible; } /// /// Converts a visibility enumeration to boolean value. /// /// Visibility enumeration /// /// /// /// public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((Visibility)value == Visibility.Visible) return false; else return true; } } }