image in XSharp app

This forum is meant for anything you would like to share with other visitors
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

image in XSharp app

Post by Chris »

Guys,

This is exactly why I wanted to post the sample solution here. I am not really familiar with how WPF works, so I was hoping that indeed a couple of you guys would step in!

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Juraj
Posts: 162
Joined: Mon Jan 09, 2017 7:00 am

image in XSharp app

Post by Juraj »

Hi Wolfgang,

Thank you for your reply.
The use of the images in the prg source code works in X# well, but I wanted it to work in the xaml code,so that a better solution can be used.

Juraj
User avatar
Chris
Posts: 4936
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

image in XSharp app

Post by Chris »

HI Juraj,
Juraj Halás wrote: Chris solution is ok but i would like if the images were not in exe, as Nick wrote, so I would like a solution in this way.
If the xaml code I use in C#, it works, the same xamlcode in X# does not work at runtime.
Can you please send me also this c# sample? I tried the same thing here too, adding the image in the XAML in the same way as you did in x# also in the c# app, but I could not get it to work at runtime in c#, either, unless I add the image in the solution and set it to Resource, as in the case with x#.

Important note, when adding the file, c# automatically marks it as Resource (not "Content" or "None" build action), so maybe you just haven't noticed that you are embedding the image also in c#? If not, please send me the sample to compare what's different, so we can make it work in x# as in c# as well.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Juraj
Posts: 162
Joined: Mon Jan 09, 2017 7:00 am

image in XSharp app

Post by Juraj »

Hi Chris,

you are right, if I change the image property "Build Action" to "None", so the error occurs also in c#.

Juraj
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

image in XSharp app

Post by Phil Hepburn »

Hi Chris and Juraj,

When I do my WPF screens I place the images in an image folder in the solution and set the BuildAction to 'Resource'. I always get the code and app to work this way.

Images attached to help out those interested.

Good Luck.
Ask if you need any more pointers and help.
Cheers,
Phil.
CPreply_03.jpg
CPreply_03.jpg (127.81 KiB) Viewed 300 times
CPreply_02.jpg
CPreply_02.jpg (78.95 KiB) Viewed 300 times
CPreply_01.jpg
CPreply_01.jpg (65.34 KiB) Viewed 300 times
Post Reply