[]
This topic explains how to apply a theme at runtime by using a dynamic expression so that the applied theme depends on the parameter’s value.
Consider a sample report 'PurchaseReport.rdlx' which can be downloaded from GitHub: ..\Samples19\DesignerPro\ReportsGallery\Reports\Page Report\Other.
Add Parameter for User Input
Open 'PurchaseReport.rdlx' report.
From the Report Explorer, right-click the Parameters node and select Add Parameter.
In the General tab of the Report - Parameters dialog, specify the following:
Go to the Available Values tab, select Non-queried option and add two themes with Label and Value settings as follows:
S.no. | Label | Value |
---|---|---|
1 | Theme1 | .\theme1.rdlx-theme |
2 | Theme2 | .\theme2.rdlx-theme |
Click OK.
Add Theme to the Report
Select the Report menu and click open the Report Properties.
Go to the Themes page and add a theme with expression:
=Parameters!ThemeParameter.Value
Apply Theme to Report Controls
Lets us apply themes to the table header and detail row. First, select the Header row of the table, and set following properties:
Select the Detail row of the table and set the following properties:
Select all the text boxes below the table and set the BackgroundColor property to =Theme.Colors!Light1
Preview the report and select any one of the two themes and click View Report to view the theme applied to the report.
> !type=note
>
> Note: Since the report needs to be re-rendered for theme to apply, on preview, you can not change the theme of the report by changing the theme selection from the report parameter. The report prompts for the report parameter for the first time and shows the result on clicking View Report, however there is no change in the applied theme if you change the theme and click View Report, unless there are updates in report that causes report to re-render.