Assigning Color Value to BackgroundColor Property from Value Converter

34 Views Asked by At

Using a converter (IValueConverter) to change background color a a border, but it does not assign the color value correctly to the BackgroundColor property.

Converter is straight forward: numeric value from source, conversion from an int (0-5) to a color name (string such as Orange, Pink, etc.).

Screenshot demonstrates the issue: enter image description here

1

There are 1 best solutions below

0
Rob5961 On

Figured it out on my own.

For reference, I changed the assignment of the output of the value converter from BackgroundColor to simply Background. Also, I changed the output from the value converter from a string (e.g. Red, White, etc) to a new brush (e.g. return new SolidColorBrush(Colors.Orange)).