32 lines
885 B
C#
32 lines
885 B
C#
namespace ThreadPilot
|
|
{
|
|
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
public class BoolToVisibilityConverter : IValueConverter
|
|
{
|
|
public static readonly BoolToVisibilityConverter Instance = new();
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is bool boolValue && boolValue)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
return Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is Visibility visibility)
|
|
{
|
|
return visibility == Visibility.Visible;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|