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 be changed at runtime.
I also have an image that needs to be changed at runtime, depending on the set of values.
I use iValueConverter to convert data to images that seem to work, but I am having problems creating the images themselves.
I am trying to create a series of objects System.Windows.Media.Imaging.BitmapImagefor storing images. As in the code above, I am trying to access the .PNG stored in the \ Images directory:
Dim ThisImage As New BitmapImage(New Uri("..\Images\thisImage.png", UriKind.Relative))
While using `` .. \ Images \ "works fine for XAML, opening the image stored in [Project Directory] \ Images \ correctly in code that seems to go to [Project Directory] \ bin \ Images \ which does not exist.
Obviously, I'm screwing something, but I do not want to start trying to go directly to the file, since it obviously will not be in the same place after installing it ...
What am I missing here? Why doesn't the XAML URI work the same as the code URI?
source
share