Page 1 of 1

Switch between images

Posted: Tue Sep 21, 2010 2:10 pm
by jmiller
I am using the WpfDesigner to create a test report. The data source has several boolean columns. On the report if the data in the column is true I want to show a green checkbox image. For false I have a read X image. I add an Image control to the report, but I cannot figure out how to have the image reflect the appropriate image based on the column. I tried adding this to the image data property:

{IIF(UserAccount.HasFullAccess==1,
System.Drawing.Image.FromFile("C:\\Development\\Icons\\GreenCheck.png"),
System.Drawing.Image.FromFile("C:\\Development\\Icons\\RedX.png")
)
}

When I try to preview the report I get the following error:
Cannot implicitly convert type 'string' to 'System.Drawing.Image'

I also notice that when I am in the Image Data tab, that nothing appears in the right, other posts seem to show something (No Data Source expander, etc).

Switch between images

Posted: Tue Sep 21, 2010 4:17 pm
by chris.procter
I'm sure a developer will give you a better answer shortly, but you might want to look more at the Conditions property; in my experience it's more flexible (and useful) than IIF.

Switch between images

Posted: Thu Sep 23, 2010 1:01 am
by Andrew
Hello,

one of good solutions is to put two Image components over each other.
Put the green checkbox image into the first component and the red X image into the second one.
And, using Condition, hide one of the Images depending on the UserAccount.HasFullAccess value.

Thank you.