Files
modernkeepass/ModernKeePass/Converters/InverseBooleanToVisibilityConverter.cs
Geoffroy Bonneville 3d033417ad Groups left collapsed menu now has a tooltip
Groups design changes: border now only around icon
Entry password reveal checkbox now works with XAML and converters
2017-11-08 14:42:38 +01:00

28 lines
947 B
C#

using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace ModernKeePass.Converters
{
public class InverseBooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
var boolean = value is bool ? (bool)value : false;
return boolean ? Visibility.Collapsed : Visibility.Visible;
}
// No need to implement this
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
var visibility = value is Visibility ? (Visibility)value : Visibility.Visible;
switch (visibility)
{
case Visibility.Visible: return false;
case Visibility.Collapsed: return true;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}