2022-05-11 15:28:20 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GeekDesk.Converts
|
|
|
|
|
|
{
|
|
|
|
|
|
internal class Visibility2BooleanConverter : IValueConverter
|
|
|
|
|
|
{
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
2023-04-13 16:39:24 +08:00
|
|
|
|
if (parameter == null)
|
2022-05-11 15:28:20 +08:00
|
|
|
|
{
|
2023-04-13 16:39:24 +08:00
|
|
|
|
return (Visibility)value == Visibility.Visible;
|
|
|
|
|
|
} else
|
2022-05-11 15:28:20 +08:00
|
|
|
|
{
|
2023-04-13 16:39:24 +08:00
|
|
|
|
return !((Visibility)value == Visibility.Visible);
|
2022-05-11 15:28:20 +08:00
|
|
|
|
}
|
2023-04-13 16:39:24 +08:00
|
|
|
|
|
2022-05-11 15:28:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((bool)value)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Visibility.Visible;
|
2022-05-20 15:39:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
2022-05-11 15:28:20 +08:00
|
|
|
|
{
|
|
|
|
|
|
return Visibility.Collapsed;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|