Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1108959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:09:38+00:00 2026-05-17T02:09:38+00:00

I have an Image declared in some XAML as: <Image Width=188 Height=56 HorizontalAlignment=Left VerticalAlignment=Bottom

  • 0

I have an Image declared in some XAML as:

<Image Width="188" Height="56" HorizontalAlignment="Left"  VerticalAlignment="Bottom" Margin="10,0,0,10" Grid.ColumnSpan="2" Grid.Column="0" Source="..\Images\myImage.png" />

This is a static image and does not need to change during program execution.

I also have an image which does need to change at runtime, depending on a set of values.

I am using an iValueConverter to convert the data to images, which seems to work, but I am having trouble creating the images themselves.

I am attempting to create a series of System.Windows.Media.Imaging.BitmapImage objects to store the images. As in the code above, I am trying to access a .PNG stored in the \Images directory:

Dim ThisImage As New BitmapImage(New Uri("..\Images\thisImage.png", UriKind.Relative))

Whereas using `”..\Images\” appears to work fine for the XAML, correctly opening the image stored in [Project Directory]\Images\, in code it seems to direct to [Project Directory]\bin\Images\, which doesn’t exist.

I’m obviously screwing up something, here, but I don’t want to start trying to navigate directly to the file, as it obviously won’t be in the same location once it’s installed…

What am I missing, here? Why is the XAML URI not working the same as the code URI?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:09:39+00:00Added an answer on May 17, 2026 at 2:09 am

    When you define the Image.Source property in XAML with a URI, a converter (ImageSourceConverter) is used to convert that URI to an ImageSource instance. The converter has access to the IUriContext of the XAML element, so it knows the base URI to use to resolve the relative URI.

    When you create a BitmapImage in code, the BitmapImage class doesn’t have access to the URI context, so it doesn’t know how to resolve the relative URI. You need to specify an absolute URI, with the form "pack://application:,,,/Images/thisImage.png"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm subclassing UITableViewCell to have one image on the far left, then some text
I have setup background image for a button as below. // declarations globally declared...
In my xml file, I have declared two imageview and later I add image
in my mxml file I have images declared like this: <mx:Image x=0 y=0 source=assets/bigpicture.png
I have a image declared like the following: [Bindable] [Embed( source=assets/banana.png )] public var
I have a user control that displays objects of a client-declared type with some
I am new to android.I have a image which is declared in xml file
I have the following dictionary declared: private readonly Dictionary<int, Image> dictionary; And I have
I have simply extended the ImageView so an image goes full width. Like so:..
At the moment i have declared my UIImage. I load in an image into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.