Conditionally hiding content

Stimulsoft Reports.WPF discussion
Post Reply
aferguson
Posts: 7
Joined: Fri Nov 20, 2009 2:39 pm

Conditionally hiding content

Post by aferguson »

Is there an easy way to c and alonditionally hide an object (e.g. a Panel and all of its children) based on some condition? The page rendering events seem like a natural place to do it, as the "Conditions" area seems only to be able to affect the "enabled" property. Are "Printable" and visibility equivalent? If so, in one of the page rendering events might you do something like:

Code: Select all

panelName.Printable = false; 
?

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Conditionally hiding content

Post by Edward »

Hi

Please use Enabled property in the BeforePrintEvent for hiding elements completely (in viewer and when printing).

'Printable' property allows to disable printing components on paper. Components will be shown in viewer, even if Printable == false.

Thank you.
satishb
Posts: 4
Joined: Sat May 20, 2017 11:15 am

Can we hide the barcode (code 39) conditionally

Post by satishb »

Hello,
While printing the barcode code39 I need to hide barcode if the scannable value is null or empty. Can we do this using stimulsoft designer tool ?
If yes then please provide the solution.
Kubekin Yuriy
Posts: 10
Joined: Wed May 17, 2017 9:24 pm

Re: Conditionally hiding content

Post by Kubekin Yuriy »

Hello, satishb.

You must use "Highlight Condition" and set "Component is Enabled" to false.
https://www.youtube.com/watch?v=rb5Um9tlpWU

Thank you.
satishb
Posts: 4
Joined: Sat May 20, 2017 11:15 am

Re: Conditionally hiding content

Post by satishb »

Thanks Kubekin Yuriy.
I had looked into your solution but, I need to hide the barcode(UI of barcode) conditionally on report if the value against that barcode is null or empty using stimulsoft designer tool.
I still facing the same problem. Please provide the solution for that if any.
Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Conditionally hiding content

Post by Alex K. »

Hello,

Please send us your report with test data which shows the issue for analysis.

Thank you.
satishb
Posts: 4
Joined: Sat May 20, 2017 11:15 am

Re: Conditionally hiding content

Post by satishb »

Hi,Please find the attachment which contains the actual image files of stimulsoft report designer and printed report.

Thanks
Attachments
Report File 1
Report File 1
Report2.png (28.71 KiB) Viewed 10218 times
Report File 2
Report File 2
Report1.png (69.89 KiB) Viewed 10218 times
satishb
Posts: 4
Joined: Sat May 20, 2017 11:15 am

Re: Conditionally hiding content

Post by satishb »

Hello Aleksey,
I just provide the image files of actual issue. Please have look into that and provide the solution for that if any.

Thanks
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Conditionally hiding content

Post by Edward »

Hi satishb,

You also can hide the BarCode component from the code before rendering the report. In the screenshots below I modified the Work With Report Components sample project:
https://www.stimulsoft.com/en/samples/w ... components
This can be done with barcodes or any other component
This is the line of code I added to hide/show the BarCode1 component in the page:

Code: Select all

((StiBarCode)stiReport1.Pages["Page1"].Components["BarCode1"]).Enabled = string.IsNullOrEmpty(textBox1.Text);
Add BarCode1 Component in the Designer and Save the Report
Add BarCode1 Component in the Designer and Save the Report
BarCode1.PNG (94.02 KiB) Viewed 10215 times
Click Preview and the BarCode1 won't print, because there is a text in the textbox
Click Preview and the BarCode1 won't print, because there is a text in the textbox
BarCode2.PNG (40.83 KiB) Viewed 10215 times
Remove Text, click Preview and BarCode1 will be printed
Remove Text, click Preview and BarCode1 will be printed
BarCode3.PNG (49.08 KiB) Viewed 10215 times
Work with Components.mrt
The modified report file from Samples-WPF-CSharp-master\Work with Report Components\ folder
(4.08 KiB) Downloaded 469 times
Thank you,
Edward
Post Reply