2025-05-28 23:19:00 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.Workbench.Converters
|
|
|
|
|
|
{
|
2025-07-30 21:15:07 +08:00
|
|
|
|
internal class BoolToVisibilityConverter : IValueConverter
|
2025-05-28 23:19:00 +08:00
|
|
|
|
{
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
2025-07-08 17:37:03 +08:00
|
|
|
|
//Debug.WriteLine($"targetType:{targetType} value:{targetType} parameter:{parameter}");
|
2025-05-28 23:19:00 +08:00
|
|
|
|
if (value is bool b)
|
|
|
|
|
|
{
|
|
|
|
|
|
return b ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
|
|
}
|
|
|
|
|
|
return Visibility.Collapsed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
return value is Visibility v && v == Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|