This type of data converter is useful if you want to change some of the control’s colors (e.g. background or foreground) according to the status of the bound source. For example, you may want the background of the text box turn to red color if there is an error related to the source.
The StatusToColorConverter can convert several types of values on its input. On its output, it provides a Color value that it chooses from one of the four colors that you can configure: UnknownColor, NormalColor, WarningColor and ErrorColor. Each color corresponds to one state, and the possible state choices are given by the StatusInfo enumeration: Unknown, Normal, Warning, and Error.
The possible input values to the StatusToColorConverter are converted as follows:
Several types in QuickOPC provide built-in conversion to StatusInfo enumeration, and can therefore be used as inputs to StatusColorConverter as well.
Following types support conversion to StatusInfo in OPC Data Access:
Following types support conversion to StatusInfo in OPC Unified Architecture:
The rules and built-in conversion are design in such way that you can easily use various kinds of bindings with the StatusToColorConverter component. For example, if you set the ArgumentsPath property of the binding to Exception, it will convert to one of two colors. Even better, if you set the ArgumentsPath of the binding to StatusInfo, it will properly convert to one of all four possible colors.