Displaying Images based on conditions

Stimulsoft Reports.WPF discussion
Post Reply
jkersch
Posts: 4
Joined: Thu Mar 25, 2010 7:24 am
Location: Vienna

Displaying Images based on conditions

Post by jkersch »

hi there,

as i cannot find information about this in the user manual, i thought i´d ask over here if anyone knows how
i can display images based on a given condition.
e.g. i have an Enum in my business objects. depending on its value i want to show small images.
in regular wpf this can be easily done using a datatrigger setting an Image´s Source property.
However, i have no clue how to do this with reports.wpf. :) i´ve seen that Style´s have an Image-Property
but it doesn't do anything and i cannot find information about it in the documentation.
is this possible at all?
thanks,
j.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Displaying Images based on conditions

Post by Jan »

Hello,

Yes it possible. Look at attached image.

Thank you.
Attachments
413.Sample.png
413.Sample.png (131.21 KiB) Viewed 4744 times
jkersch
Posts: 4
Joined: Thu Mar 25, 2010 7:24 am
Location: Vienna

Displaying Images based on conditions

Post by jkersch »

Hell Jan,

thanks for your reply. the solution you provided indicates that in my special case i have to add two images where each of it is disabled (i.e. invisible) under certain circumstandes? as far as i understand it is not possible to add a field that changes the image source depending on e.g. different values of an enum?
is this assumption correct? just to be clear what paths i can go to achieve what i want ;)
thanks
j.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Displaying Images based on conditions

Post by Jan »

Hello,

You can add following lines of code to BeforePrintEvent of page:

Code: Select all

if (condition)
{
  Image1.Enabled = false;
  Image2.Enabled = false;
}
else
{
  Image1.Enabled = true;
  Image2.Enabled = true;
}
Thank you.
Post Reply