C
C#12mo ago
aspes

add image programmatically

my images are not showing up when adding them as followed:
c#
Image image = new Image();
BitmapImage bitmap = new BitmapImage(new Uri(imagePath, UriKind.Relative));
image.Source = bitmap;
overlayWindow.Children.Add(image);
c#
Image image = new Image();
BitmapImage bitmap = new BitmapImage(new Uri(imagePath, UriKind.Relative));
image.Source = bitmap;
overlayWindow.Children.Add(image);
am i missing something completely? the path is correct !
1 Reply
mjj
mjj12mo ago
try { Image image = new Image(); BitmapImage bitmap = new BitmapImage(new Uri(imagePath, UriKind.Relative)); image.Source = bitmap; overlayWindow.Children.Add(image); } catch (Exception ex) { Console.WriteLine("Error loading image: " + ex.Message); }
Want results from more Discord servers?
Add your server