0
I’m trying to create an object like Image from an existing image, which will be inserted into a Frame and which in turn will be inserted into a Stackpanel. However, only images/icons that are inserted within the project are displayed in the component (#2). I did tests to check if it is the file that does not exist, but does not enter (#1).
Does anyone know what it is? All files are with access permission 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);
I was able to solve my problem with the video: https://www.youtube.com/watch?v=Nb89r13Z1q4 Grateful :)
– Guilherme Paschoal