i'm making a WPF desktop app, i need to display 15,000 elements in a stackpanel with rows and columns, i have 4 elements declared like this:
public class PasaImagen
{
public string imagenbindeada { get; set; }
public int TiempoDeVida { get; set; }
//public int Cantidad { get; set; }
}
if (imagenrandom1 == 1)
{
//string consecutivas = "/foto" + imagenrandom1.ToString() + ".png";
items1[i].Add(new PasaImagen { imagenbindeada = "/pasto.png", TiempoDeVida=TiempoDeVidaPasto });
matriz1[j, i] = "pasto";
listapocicionesdematriz1.Add(i.ToString() + " , " + j.ToString());
}
if (imagenrandom1 == 2)
{
//string consecutivas = "/foto" + imagenrandom1.ToString() + ".png";
items1[i].Add(new PasaImagen { imagenbindeada = "/conejo.png", TiempoDeVida=TiempoDeVidaConejo });
matriz1[j, i] = "conejo";
listapocicionesdematriz1.Add(i.ToString() + " , " + j.ToString());
}
if (imagenrandom1 == 3)
{
//string consecutivas = "/foto" + imagenrandom1.ToString() + ".png";
items1[i].Add(new PasaImagen { imagenbindeada = "/lobo.png", TiempoDeVida=TiempoDeVidaLobo });
matriz1[j, i] = "lobo";
listapocicionesdematriz1.Add(i.ToString() + " , " + j.ToString());
}
if (imagenrandom1 == 4)
{
items1[i].Add(new PasaImagen { imagenbindeada = "/tierra.png" ,TiempoDeVida=TiempoDeVidaTierra });
matriz1[j, i] = "tierra";
listapocicionesdematriz1.Add(i.ToString() + " , " + j.ToString());
}
The real problem is when i have to display them in the stackpanel, when i use 1,000 elements, i have no problem with them, they are continuously moving between one cell to another in a loop, no problem with that, but then i use like 6,000 elements, the performance of the app is very slow, and their movement becomes very slow and poor.
The question is, how can i transform the Uri image or the image in order to make them easier to read for the program and make a better performance when displaying the items when executing?