40 lines
950 B
C#
40 lines
950 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace GeekDesk.Converts
|
|
{
|
|
internal class Boolean2VisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
bool param = false;
|
|
if (value != null)
|
|
{
|
|
param = (bool)value;
|
|
}
|
|
if (param)
|
|
{
|
|
return Visibility.Visible;
|
|
} else
|
|
{
|
|
return (Visibility)parameter;
|
|
}
|
|
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if ((bool)value)
|
|
{
|
|
return Visibility.Visible;
|
|
}
|
|
else
|
|
{
|
|
return Visibility.Hidden;
|
|
}
|
|
}
|
|
}
|
|
}
|