Switch between images

Stimulsoft Reports.WPF discussion
Post Reply
jmiller
Posts: 91
Joined: Mon Sep 20, 2010 12:18 pm

Switch between images

Post 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).
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

Switch between images

Post 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.
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Switch between images

Post 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.
Post Reply