public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var flag = false; if (values != null && values.Length == 3) { KeyControl keyControl = values[0] as KeyControl; string uuid = values[1] as string; bool? isSelected = values[2] as bool?; if (keyControl != null && !string.IsNullOrEmpty(uuid) && isSelected != null && isSelected.HasValue) { flag = keyControl.DoesPdfExist(uuid) && isSelected.Value; } } if (parameter != null) { if (bool.Parse((string)parameter)) { flag = !flag; } } if (flag) { return(Visibility.Visible); } else { return(Visibility.Collapsed); } }