23 lines
640 B
C#
23 lines
640 B
C#
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace Livia.Views.Converters;
|
|
|
|
[ValueConversion(typeof(bool), typeof(Visibility))]
|
|
public class BooleanToVisibilityHiddenConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is not bool b)
|
|
return Visibility.Collapsed;
|
|
|
|
return b ? Visibility.Visible : Visibility.Hidden;
|
|
}
|
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
} |