Genom
Topic Author
Posts: 47
Joined: 04 Dec 2014, 14:47

Resource/Image path

09 Feb 2015, 22:50

Hi guys, anyd idea how not to end with neverending "../../../" ?
<Grid Width="100" Height="100">
    <Image Grid.Column="1" Source="../../../../../../Images/Carta/CameraIcon.png"></Image>
</Grid>
Of course, I've tried just "./" and "~/" but no success :/

cheers!
 
User avatar
jsantos
Site Admin
Posts: 2923
Joined: 20 Jan 2012, 17:18
Contact:

Re: Resource/Image path

10 Feb 2015, 20:48

What do you exactly mean? We support two kind of URIs (compatible with WPF): absolute and relative.

By default, a relative pack URI is considered relative to the location of the XAML that contains the reference. For example:
<Image Source="Images/icon.png" />
Absolute URIs are considered relative to the root of the project (.csproj) indicated. For example:
<Image Source="/Sample;component/Images/icon.png" />
In this example, the Images folder must be located next to the project file, Sample.csproj in this case.
 
User avatar
jsantos
Site Admin
Posts: 2923
Joined: 20 Jan 2012, 17:18
Contact:

Re: Resource/Image path

10 Feb 2015, 20:50

This is explained a bit better in the v1.2 documentation: Gui.Core.URIs.html (cannot link to it because v1.2 documentation is yet not online)
 
Genom
Topic Author
Posts: 47
Joined: 04 Dec 2014, 14:47

Re: Resource/Image path

10 Feb 2015, 23:02

Hi, it is still not working for me

nor this:
<Image Source="/UnityVS.PruebaXamlUnity.CSharp;component/Images/Common/logo.png" />
with error:
Unable to open C:/WinDevelopment/Pruebas/PruebaXamlUnity/PruebaXamlUnity/Assets/Libraries/IOrder.Lib.UI/Views/Assets
/Images/Common/logo.png

neither these others
<Image Source="/UnityVS.PruebaXamlUnity.CSharp;component/Assets/Images/Common/logo.png" />

<Image Source="/PruebaXamlUnity.CSharp;component/Images/Common/logo.png" />
<Image Source="/PruebaXamlUnity;component/Images/Common/logo.png" />
<Image Source="Assets/Images/Common/logo.png" />

etc..
 
User avatar
sfernandez
Site Admin
Posts: 1935
Joined: 22 Dec 2011, 19:20

Re: Resource/Image path

11 Feb 2015, 18:00

Hi Genom,

By the error message you are getting I guess you are working with 1.1 version, right?
Unfortunately, in that version your only option when referencing resources from other folder branch is to use "../".

The "/Sample;component/Images/icon.png" option that is more appropriate for what you are looking for, is only working as explained by jsantos, in 1.2 version.
 
Genom
Topic Author
Posts: 47
Joined: 04 Dec 2014, 14:47

Re: Resource/Image path

11 Feb 2015, 18:04

Ok, this about 1.2 I wasn't sure.

thanks!

Who is online

Users browsing this forum: No registered users and 6 guests