Skip to content

Instantly share code, notes, and snippets.

@alexcurtis
Created December 2, 2012 12:08
Show Gist options
  • Save alexcurtis/4188371 to your computer and use it in GitHub Desktop.
Save alexcurtis/4188371 to your computer and use it in GitHub Desktop.
Boolean To Visible / Hidden WPF Value Converter
public class BooleanToVisibileHiddenConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var boolean = false;
if (value is bool) boolean = (bool)value;
return boolean ? Visibility.Visible : Visibility.Hidden;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Visibility && (Visibility)value == Visibility.Visible;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment