public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// Checks if the value provided is null, if so then tell the converter that the value is unset
if (value == null)
return DependencyProperty.UnsetValue;
// Gets the value as type and check if it is null, if so then tells the converter, that the type of the object is used
Type typeValue = value as Type;
if (typeValue == null)
typeValue = value.GetType();
// Gets the parameter and check if it is null, if so then tells the converter, that the value is unset
Type parameterValue = parameter as Type;
if (parameterValue == null)
return DependencyProperty.UnsetValue;
// If the parameter equals the value that is to be converted, then returns visible, otherwise hidden is returned
return typeValue == parameterValue ? Visibility.Visible : Visibility.Collapsed;
}