QuickOPC User's Guide and Reference
Change Color According to Status
View with Navigation Tools
Development Models > Live Binding Model > Live Binding Model for OPC Data (Classic and UA) > Typical Binding Scenarios > Change Color According to Status

Values can be converted in both directions by IDataConverter objects. For example, StatusToColorConverter provides a color value based on operation status, such as a yellow background when quality is Uncertain.

How to configure this feature:

Place the StatusToColorConverter component (from the toolbox items) onto the component tray. Bind the OPC-DA item (or OPC-UA node attribute) to your control as usually.

Then, use the "Edit Live Bindings" command, "Clone" the existing binding, and change the cloned binding as follows: Set the ArgumentsPath to StatusInfo. Set the ValueTarget.TargetMember to the BackColor (in Windows Forms), Background (in WPF), or other suitable property of your control. For the Converter property, select the StatusToColorConverter you have placed to the form earlier. This will cause the status information from the OPC item be converted to one of configurable colors, and change the background color of the control appropriately.

See Also