Conditionally Change a Control's Appearance

This document describes how to change a report control's appearance based on a specific condition.


You can use this approach to conditional formatting when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Expressions or DataBindingMode.ExpressionsAdvanced.

See Conditionally Change a Control's Appearance to learn about the legacy approach to solving this task.

See Data Binding Modes to learn more about the available binding modes.

  • Switch to the Report Explorer and right-click the Styles category to create a new visual style.


  • Right-click the created styles and select Edit Styles.


  • This invokes the Styles Editor for customizing the created style's appearance settings.


  • Create another style by cloning the existing one.


  • Customize the new style's appearance settings and close the editor.


  • Back in the Report Explorer, select a report element to which you wish to assign the created styles.


  • Switch to the Expressions section in the Properties window and click the ellipsis button for the control's StyleName property (you can find it under the BeforePrint event's category if you are using the ExpressionsAdvanced binding mode).


  • This invokes the Expression Editor where you can specify the required condition for switching between the created styles.


Switch to Print Preview to view the resulting report: