Answer the question
In order to leave comments, you need to log in
How to properly set Bitmap.UriSource to Image.Source?
Hello!
You need to set an image for Image.Source.
I do it like this:
Image img = new();
string path = Directory.GetCurrentDirectory();
path = path + "\\.(тут остальной путь).\\image.png";
BirmapImage bitmapImg = new();
bitmapImg.UriSource = new Uri(path);
img.Source = bitmapImg;
Answer the question
In order to leave comments, you need to log in
1. UriSource accepts a path relative to the working directory, not an absolute path
2. The separator is a normal slash (/), not a backslash (\)
But I need the path to refer to an already compiled directory
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question