#if SILVERLIGHT namespace Caliburn.Micro { using System; using System.Globalization; using System.Windows; using System.Windows.Data; /// /// An which converts to . /// public class BooleanToVisibilityConverter : IValueConverter { /// /// Converts a boolean value to a value. /// /// The value produced by the binding source. /// The type of the binding target property. /// The converter parameter to use. /// The culture to use in the converter. /// /// A converted value. If the method returns null, the valid null value is used. /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return ((bool)value) ? Visibility.Visible : Visibility.Collapsed; } /// /// Converts a value value to a boolean value. /// /// The value that is produced by the binding target. /// The type to convert to. /// The converter parameter to use. /// The culture to use in the converter. /// /// A converted value. If the method returns null, the valid null value is used. /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return ((Visibility)value) == Visibility.Visible; } } } #endif #if WinRT namespace Caliburn.Micro { using System; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; /// /// An which converts to . /// public class BooleanToVisibilityConverter : IValueConverter { /// /// Converts a boolean value to a value. /// /// The value produced by the binding source. /// The type of the binding target property. /// The converter parameter to use. /// The language to use in the converter. /// /// A converted value. If the method returns null, the valid null value is used. /// public object Convert(object value, Type targetType, object parameter, string language) { return ((bool)value) ? Visibility.Visible : Visibility.Collapsed; } /// /// Converts a value value to a boolean value. /// /// The value that is produced by the binding target. /// The type to convert to. /// The converter parameter to use. /// The language to use in the converter. /// /// A converted value. If the method returns null, the valid null value is used. /// public object ConvertBack(object value, Type targetType, object parameter, string language) { return ((Visibility)value) == Visibility.Visible; } } } #endif