namespace File360
{
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
///
/// Converts a Boolean into a Visibility.
///
public class BoolToVisibilityConverter : IValueConverter
{
///
/// If set to True, conversion is reversed: True will become Collapsed.
///
public bool IsReversed { get; set; }
public object Convert(object value, Type targetType, object parameter, string language)
{
var val = System.Convert.ToBoolean(value);
if (this.IsReversed)
{
val = !val;
}
if (val)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}