1
0
mirror of https://github.com/DarthAffe/RGBSyncPlus synced 2025-12-13 01:18:30 +00:00
RGBSyncPlus/RGBSync+/Converter/NullToVisibilityConverter.cs

21 lines
709 B
C#

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace RGBSyncPlus.Converter
{
[ValueConversion(typeof(object), typeof(Visibility))]
public class NullToVisibilityConverter : IValueConverter
{
#region Methods
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> (value == null) == (string.Equals(parameter?.ToString(), "true", StringComparison.OrdinalIgnoreCase)) ? Visibility.Visible : Visibility.Hidden;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();
#endregion
}
}