I'm trying to create an object of type Image from an existing image, which will be inserted into a Frame and in turn will be inserted into a > StackPanel . However, only images / icons that are inserted inside the project are displayed in the component (# 2). I tried to check if it is the file that does not exist, but it does not enter (# 1).
Does anyone know what it is? All files are allowed access for all users ...
if (!File.Exists("C:/Users/32-add.png")) MessageBox.Show("");
//teste para verificar a existência (#1)
//Uri imageUri = new Uri(photoPath + "32-star.png", UriKind.Relative);
//testando com um ícone do meu projeto, aqui vai (#2)
Uri imageUri = new Uri("C:/Users/32-add.png", UriKind.Relative);
//aqui não vai
BitmapImage imageBitmap = new BitmapImage(imageUri);
Image img = new Image {Source=imageBitmap, Width = 130, Height = 130, MinWidth = 130, MinHeight = 130};
//conversão
Frame frame = new Frame{Content = img};
stackPanel.Children.Add(frame);