Reputation: 16705
I have the following converter:
public class MyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return Visibility.Hidden;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
...
I'm then using this in XAML as follows:
<Resources>
<conv:MyConverter x:Key="MyValToVisibilityConverter" />
</Resources>
...
<CheckBox x:Name="MyCheckBox" Content="Should not be visible"
Visibility="{Binding ElementName=Visibility, Converter={StaticResource MyValToVisibilityConverter}}"
...
This compiles and runs, and always shows the checkbox as visible.
Upvotes: 1
Views: 7088
Reputation: 437594
You are setting the wrong parameter for the binding.
Right now, the bind target is an element named Visibility
, which is most likely an error:
Visibility="{Binding ElementName=Visibility, Converter={...}}"
It should simply be
Visibility="{Binding Converter={...}}"
Upvotes: 3