26 lines
814 B
C#
26 lines
814 B
C#
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace CodeContextGenerator.Converters;
|
|
|
|
public class BooleanToVisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
bool boolValue = value is true;
|
|
|
|
// Проверяем параметр для инвертирования
|
|
if (parameter is string paramStr && paramStr.Equals("Inverted", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
boolValue = !boolValue;
|
|
}
|
|
|
|
return boolValue ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
} |