I'm trying to load images at runtime and each one is selected by a switch:
seguimiento.tareaA = new Image();
switch (rowTarea["idTareaTipo"].ToString())
{
case "f7f91a6f-24a2-1034-b505-d1f8671a4f3f"://Seguimiento
Uri uri = new Uri("pack://application:,,,/Resources/Seguim_Chico__0000_6_Pago_Rojo.png");
BitmapImage bmp = new BitmapImage(uri);
seguimiento.tareaA.Source = bmp;
break;
When running the program, it does not give errors but the images are not loaded either... I tried to debug and the only strange thing I found was an error in the Metadata when creating the BitmapImage:
How can I fix the error or make the image display?
At some point I had that problem and found a post on the original SO
The trick is to put the origin between the methods
BeginInit()
andEndInit()
The explanation is in the official documentation :
Try this: