我对Visibility有这种约束
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
我想设Visibility = False
ComputedVerticalScrollBarVisibility = True
和Visibility = True
if ComputedVerticalScrollBarVisibility = false
有这样的事情:
Visibility="!{TemplateBinding ComputedVerticalScrollBarVisibility}"
由于 西
答案 0 :(得分:2)
至于Hasan的观点,转换器非常简单:
public class VisibilityInverterConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is Visibility)
{
var vis = (Visibility) value;
if (vis == Visibility.Hidden || vis == Visibility.Collapsed)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}