public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool isSelected; if (bool.TryParse(value.ToString(), out isSelected)) { return(isSelected ? BrushHelper.GetBrushForHex(HighlightColourHex) : BrushHelper.GetBrushForHex(DefaultColourHex)); } return(new SolidColorBrush(Colors.White)); }