Multiprocotol Terminalprogram (BAT)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
956 B

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MultiTerm.Wpf.CustomControl;
/// <summary>
/// Converts <see cref="bool"/> to <see cref="Visibility"/>.
/// If true = Visible, false = Colapsed
/// </summary>
[ValueConversion(typeof(bool), typeof(Visibility))]
internal class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is not bool boolVal) { throw new ArgumentException($"{nameof(BoolToVisibilityConverter)}.{nameof(Convert)} got type other than bool."); }
if (boolVal)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}