mercredi 1 juillet 2020

change image with for loop statement in Xamarin

I have 13 images shown in page ,one of them is fixed and others changed depend on some data ,i made 12 if statement and it works ,but is there way to create one if statement with for loop like thus :

for (int i = 2; i >= 13; i++)
            {
                if (m_id >= i)
                {
                    
                    "image" + i.Source = ImageSource.FromFile("months" + i + ".png");
                }
                else
                {
                    "image" + i.Source = ImageSource.FromFile("months"+i+"closed.png");
                }
            }

Aucun commentaire:

Enregistrer un commentaire