Cancel
Showing results for 
Search instead for 
Did you mean: 

WPF Interfaces in Viewers Using Images

Hello,

 

I am using a WPF User Control implementing the ITxViewerControl interface in a viewer.  One thing I have not yet managed to figure out is how to use images in custom viewers for Process Simulate.  What I am trying to accomplish is to be able to uses images for creating custom button styles in WPF.  

 

I have attempted to set an image file as an embedded resource and then reference it in the image tag as in...

 <Image Source="Images\FlowStationImg.png" />

 

I have also tried placing the images in many places throughout the eMPower directory including eMPower and in the DotNetViewers/Images, in DotNetViewers itself, etc, while changing the address in the image tag to match.  

 

I know i am missing something obvious, so I figured I'd reach out to the community to see if anyone else has the correct methodology to include an image as a part of a control in WPF in a Process Simulate Viewer.

 

12 REPLIES

Betreff: WPF Interfaces in Viewers Using Images

Legend
Legend

Try

<Image Source="/YOURPROJECTNAME;component/Images/FlowStationImg.png" />

Betreff: WPF Interfaces in Viewers Using Images

That would be the answer in a normal desktop WPF application in some cases, but Process Simulate routes references differently.  I suspect it is a combination of the URL I put in the XAML tag and placement of the image file, or in the build action I am setting it to.

 

It shows up in my design window, but not when Process Simulate starts up.

Betreff: WPF Interfaces in Viewers Using Images

Legend
Legend

I have all my projects in WPF and it works this way.

 

Build action for the images is set to Resource.

Betreff: WPF Interfaces in Viewers Using Images

I am using a .png file as a test.  It is set to build action Embedded Resource.  Are you placing the image file somewhere for process Simulate to find?

Betreff: WPF Interfaces in Viewers Using Images

Legend
Legend

You are using the wrong build action! Embedded Resource doesn't work. You have to use Resource.

From your first post I assume that you have am Image folder in your project, haven't you?

If so, my first code snippet would be correct!

Betreff: WPF Interfaces in Viewers Using Images

I just added another image using the Add Existing item as a "Resource" build action as default and it worked. No idea why it hasn't worked before.

Betreff: WPF Interfaces in Viewers Using Images

Yes,  I was going about it all wrong with the Build Action, and assuming that Process Simulate was looking for me to store the image somewhere in eMPower.  Thank you for clarifying for me.  6 Years of working with this API and I'm still learning lol.

Betreff: WPF Interfaces in Viewers Using Images

Legend
Legend

Everybody is still learning. Learning will never stop and that is good! Smiley Wink

 

By the way, I am really looking forward to the planned API training in May. Are there any news availabe? Will it take place im Munich?

Betreff: WPF Interfaces in Viewers Using Images

They have not advertised that over here in North America, so I was unaware there was training available for this.

[cid:image001.jpg@01CCBBFB.23378BD0]
Cliff Knasinski
ME Robotic Development Engineer
Email: Clifford.Knasinski@fcagroup.com
[FCA_NAFTA]