Changing the Source of an Image in XAML through C#

So I have a Grid name Game (the main game board) what I wanna do is load every image from inside the grid when the program loads

foreach(Image myImage in Game.Children)
            {
                BitmapImage bi3 = new BitmapImage();
                bi3.UriSource = new Uri("ms-appx:///Assets/SmallLogo.png");
                myImage.Stretch = Stretch.Fill;
                myImage.Source = bi3;
            }

I am using this foreach but I always get error messages. I tried a lot of different methods but none worked so far. I am trying to make a matching memory game.
Thanks in advance


Source: windows

Leave a Reply