Octgn.Play.Gui.HighlightColorConverter.Convert C# (CSharp) Method

Convert() public method

public Convert ( object values, Type targetType, object parameter, CultureInfo culture ) : object
values object
targetType System.Type
parameter object
culture CultureInfo
return object
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length != 2 || values[0] == DependencyProperty.UnsetValue) return DependencyProperty.UnsetValue;
            var selected = (bool)values[0];
            var color = (Color?)values[1];

            if (selected) return Brushes.Yellow;

            if (!color.HasValue)
                return Brushes.White;
            // White should never appear on screen -> the card is neither selected nor has a highlight      
            var brush = new SolidColorBrush(color.Value);
            brush.Freeze();
            return brush;
        }
HighlightColorConverter