Page 1 of 1

Displaying Images based on conditions

Posted: Wed May 12, 2010 1:39 am
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.

Displaying Images based on conditions

Posted: Wed May 12, 2010 5:20 am
by Jan
Hello,

Yes it possible. Look at attached image.

Thank you.

Displaying Images based on conditions

Posted: Fri May 14, 2010 4:48 am
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.

Displaying Images based on conditions

Posted: Fri May 14, 2010 8:13 am
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.