Search code examples
c#c++.netwindows-phone-8.net-framework-version

Can someone explain the RelativeOrAbsolute parameter in overloaded version of URI class?


The following code assigns the Microphone.png image to image of button but I failed to understand the role of relative parameter in overloaded version of Uri class.

RecordButton.IconUri = new Uri(
    "/Assets/AppBar/microphone.png", UriKind.Relative);

Solution

  • Exemple : Relative => You should be in the same folder. Folder 1 contains one page " page 1 " and an image "X" Folder 2 contains one page " page 2 "

    You are in the page 2 and you write =>

    <image source="X.png" /> 
    

    You can't do this because you are not in the correct folder but you can write "/Folder1/X.png" or "../Folder1/X.png".

    Absolute => Full path like http://Abundantcode.com/image.jpg

    For windows phone developpement, you have uriking.relativeorabsolute property :D